I use the following MP4Box command to generate the manifest file(.mpd). The manifest file is common to different video representations.
MP4Box -dash 5000 -frag 5000 -fps 25 -frag-rap -rap -bs-switching merge -profile dashavc264:live -mpd-title "Mpeg Dash Preview" -segment-ext null -segment-name seg_ -out test.mpd resolution_480p.mp4#video:baseURL=./v/ resolution_360p.mp4#video:baseURL=./v_360/ resolution_720p.mp4#video:baseURL=./v_720/ resolution_480p.mp4#audio:baseURL=./a/
Though dash.js is playing the video, only single bitrate is being played without switching the resolution according to network condition. Am I missing something in the command? or should I enable Adaptive Bitrate Switching in the player?
Manifest file
<?xml version="1.0"?>
<!-- MPD file Generated with GPAC version 0.6.0-revUNKNOWN-UNKNOWN at 2016-09-12T11:58:50.789Z-->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500S" type="static" mediaPresentationDuration="PT0H1M2.502S" maxSegmentDuration="PT0H0M5.000S" profiles="urn:mpeg:dash:profile:isoff-live:2011,http://dashif.org/guidelines/dash264">
<ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
<Title>Mpeg Dash Preview</Title>
</ProgramInformation>
<Period duration="PT0H1M2.502S">
<AdaptationSet segmentAlignment="true" maxWidth="1280" maxHeight="720" maxFrameRate="25" par="28800:15480" lang="und">
<SegmentTemplate timescale="12800" media="seg_$Number$" startNumber="1" duration="64000" initialization="seg_init"/>
<Representation id="1" mimeType="video/mp4" codecs="avc1.42c015" width="480" height="360" frameRate="25" sar="60:43" startWithSAP="1" bandwidth="796236">
<BaseURL>./v/</BaseURL>
</Representation>
<Representation id="2" mimeType="video/mp4" codecs="avc1.42c01e" width="640" height="480" frameRate="25" sar="60:43" startWithSAP="1" bandwidth="1208202">
<BaseURL>./v_360/</BaseURL>
</Representation>
<Representation id="3" mimeType="video/mp4" codecs="avc1.42c01f" width="1280" height="720" frameRate="25" sar="45:43" startWithSAP="1" bandwidth="2715861">
<BaseURL>./v_720/</BaseURL>
</Representation>
</AdaptationSet>
<AdaptationSet segmentAlignment="true" lang="hin">
<SegmentTemplate timescale="48000" media="seg_$Number$" startNumber="1" duration="240000" initialization="seg_init"/>
<Representation id="4" mimeType="audio/mp4" codecs="mp4a.40.2" audioSamplingRate="48000" startWithSAP="1" bandwidth="343385">
<BaseURL>./a/</BaseURL>
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
</Representation>
</AdaptationSet>
</Period>
</MPD>
Related
everybody.
I am new to logstash. I've been studying filters in logstash for a week, but no result.
I want to parse xml. I have the following xml:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<ContinentLogs>
<Cryptogateways>
<cgw id="1" cssid="0" ip="0.0.0.0" tz="RCPTZ -3:00 RCPTZS -4:00,M0.0.0/00:00:00,M0.0.0/00:00:00">ЦУС</cgw>
<cgw id="2" cssid="50556" ip="0.0.0.0" tz="RCPTZ -3:00 RCPTZS -4:00,M0.0.0/00:00:00,M0.0.0/00:00:00">DP.152FZ.DA01</cgw>
<cgw id="3" cssid="50557" ip="0.0.0.0" tz="RCPTZ -3:00 RCPTZS -4:00,M0.0.0/00:00:00,M0.0.0/00:00:00">M1.152FZ.DA01</cgw>
<cgw id="4" cssid="51358" ip="0.0.0.0" tz="RCPTZ 00:00 RCPTZS 00:00,M0.0.0/00:00:00,M0.0.0/00:00:00">3D Get</cgw>
<cgw id="5" cssid="51491" ip="0.0.0.0" tz="RCPTZ -3:00 RCPTZS -4:00,M0.0.0/00:00:00,M0.0.0/00:00:00">М1.152FZ.CUS02</cgw>
<cgw id="6" cssid="51845" ip="0.0.0.0" tz="RCPTZ -3:00 RCPTZS -4:00,M0.0.0/00:00:00,M0.0.0/00:00:00">DP.152FZ.FW01</cgw>
<cgw id="7" cssid="51847" ip="0.0.0.0" tz="RCPTZ -3:00 RCPTZS -4:00,M0.0.0/00:00:00,M0.0.0/00:00:00">M1.152FZ.FW01</cgw>
<cgw id="8" cssid="53840" ip="0.0.0.0" tz="RCPTZ -3:00 RCPTZS -4:00,M0.0.0/00:00:00,M0.0.0/00:00:00">M1.152FZ.FW02</cgw>
<cgw id="9" cssid="68604" ip="0.0.0.0" tz="RCPTZ -3:00 RCPTZS -4:00,M0.0.0/00:00:00,M0.0.0/00:00:00">TNC MIG</cgw>
<cgw id="10" cssid="69007" ip="0.0.0.0" tz="RCPTZ -3:00 RCPTZS -4:00,M0.0.0/00:00:00,M0.0.0/00:00:00">HAKR</cgw>
<cgw id="11" cssid="111846" ip="0.0.0.0" tz="RCPTZ -3:00 RCPTZS -4:00,M0.0.0/00:00:00,M0.0.0/00:00:00">ALT MOT</cgw>
<cgw id="12" cssid="111978" ip="0.0.0.0" tz="RCPTZ -3:00 RCPTZS -4:00,M0.0.0/00:00:00,M0.0.0/00:00:00">GPB RIM</cgw>
</Cryptogateways>
<FilterRules>
<rule id="-8" deleted="false">Pravil</rule>
<rule id="-5" deleted="false">(?) Neopredelen</rule>
<rule id="-3" deleted="false">Udalenni pravila</rule>
<rule id="-2" deleted="false">SD prav</rule>
<rule id="-1" deleted="false">Slygeb prav</rule>
<rule id="0" deleted="false">Ne sootvetsvyet</rule>
<rule id="17" deleted="false">Mon => Mail Server</rule>
</FilterRules>
</ContinentLogs>
I want to remove lines that have «cgw id="3"» и «cgw id="7"» in the section.
And remove the lines that have «rule id="-5"» и «rule id="0"» in the section.
Write everything back to xml without changing anything else.
Help how to do this through Logstash?
Thank you in advance.
if your logstash is feeding the ELK, then your solution should be in Prune blacklist
first, add the item you want in the xpath
for example
let my Xml file be like
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
</Console>
</Appenders>
<Loggers>
<Logger name="com.foo.Bar" level="trace">
<AppenderRef ref="Console" />
</Logger>
<Logger name="com.foo.Bar.test.2.error" level="error">
<AppenderRef ref="Console" />
</Logger>
<Root level="error">
<AppenderRef ref="Console" />
</Root>
</Loggers>
</Configuration>
and now in the configuration file use the filter as the following.
filter {
xml {
source => "message"
store_xml => false
target => "rec"
xpath => [
"/Configuration /#status", "Configuration_LEVEL" // defining my item to delete
]
}
prune {
blacklist_names => ["Configuration_LEVEL"] // delete the item using prune blacklist
}
}
I hope it helped you.
I've generated segments files and .mpd manifest file using MP4Box. And I uploaded segments to firebase storage. Then I changed .mpd file's segment urls to firebase storage download urls. But this gives me an invalid mpd file.
.mpd file right after MP4Box generation:
<?xml version="1.0"?>
<!-- MPD file Generated with GPAC version 0.8.0-revrelease at 2019-08-06T09:00:00.629Z-->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500S" type="static" mediaPresentationDuration="PT0H0M38.080S" maxSegmentDuration="PT0H0M5.005S" profiles="urn:mpeg:dash:profile:full:2011">
<ProgramInformation moreInformationURL="http://gpac.io">
<Title>try_1.mpd generated by GPAC</Title>
</ProgramInformation>
<Period duration="PT0H0M38.080S">
<AdaptationSet segmentAlignment="true" maxWidth="1280" maxHeight="720" maxFrameRate="24000/1001" par="16:9" lang="und" startWithSAP="1">
<ContentComponent id="1" contentType="video" />
<ContentComponent id="2" contentType="audio" />
<Representation id="1" mimeType="video/mp4" codecs="avc1.64001F,mp4a.40.2" width="1280" height="720" frameRate="24000/1001" sar="1:1" audioSamplingRate="48000" bandwidth="1545875">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
<SegmentList timescale="1000" duration="4000">
<Initialization sourceURL="segment_init.mp4"/>
<SegmentURL media="segment_1.m4s"/>
<SegmentURL media="segment_2.m4s"/>
<SegmentURL media="segment_3.m4s"/>
<SegmentURL media="segment_4.m4s"/>
<SegmentURL media="segment_5.m4s"/>
<SegmentURL media="segment_6.m4s"/>
<SegmentURL media="segment_7.m4s"/>
<SegmentURL media="segment_8.m4s"/>
</SegmentList>
</Representation>
</AdaptationSet>
</Period>
</MPD>
.mpd file after I changed SegmentURL:
<?xml version="1.0"?>
<!-- MPD file Generated with GPAC version 0.8.0-revrelease at 2019-08-06T09:00:00.629Z-->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500S" type="static" mediaPresentationDuration="PT0H0M38.080S" maxSegmentDuration="PT0H0M5.005S" profiles="urn:mpeg:dash:profile:full:2011">
<ProgramInformation moreInformationURL="http://gpac.io">
<Title>try_1.mpd generated by GPAC</Title>
</ProgramInformation>
<Period duration="PT0H0M38.080S">
<AdaptationSet segmentAlignment="true" maxWidth="1280" maxHeight="720" maxFrameRate="24000/1001" par="16:9" lang="und" startWithSAP="1">
<ContentComponent id="1" contentType="video" />
<ContentComponent id="2" contentType="audio" />
<Representation id="1" mimeType="video/mp4" codecs="avc1.64001F,mp4a.40.2" width="1280" height="720" frameRate="24000/1001" sar="1:1" audioSamplingRate="48000" bandwidth="1545875">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
<SegmentList timescale="1000" duration="4000">
<Initialization sourceURL="https://firebasestorage.googleapis.com/v0/b/angar-fashion.appspot.com/o/dash-mpeg%2Fsegment_init.mp4?alt=media&token=52f0a3e4-8994-4538-876e-14aaa4d5ab29"/>
<SegmentURL media="https://firebasestorage.googleapis.com/v0/b/angar-fashion.appspot.com/o/dash-mpeg%2Fsegment_1.m4s?alt=media&token=ec1c7959-3191-4774-8187-ad4f8358a91c"/>
<SegmentURL media="https://firebasestorage.googleapis.com/v0/b/angar-fashion.appspot.com/o/dash-mpeg%2Fsegment_2.m4s?alt=media&token=7cca4f12-c295-45b9-b094-0115f2415c95"/>
<SegmentURL media="https://firebasestorage.googleapis.com/v0/b/angar-fashion.appspot.com/o/dash-mpeg%2Fsegment_3.m4s?alt=media&token=6aef7cb0-a637-4abb-9e92-c9cb44805d27"/>
<SegmentURL media="https://firebasestorage.googleapis.com/v0/b/angar-fashion.appspot.com/o/dash-mpeg%2Fsegment_4.m4s?alt=media&token=01df0576-401d-4b2a-8434-6f11ecdb74bf"/>
<SegmentURL media="https://firebasestorage.googleapis.com/v0/b/angar-fashion.appspot.com/o/dash-mpeg%2Fsegment_5.m4s?alt=media&token=2ec2692f-5178-4b74-bfa8-cf862fc7e2b4"/>
<SegmentURL media="https://firebasestorage.googleapis.com/v0/b/angar-fashion.appspot.com/o/dash-mpeg%2Fsegment_6.m4s?alt=media&token=a18b54ea-2e81-4ec6-8030-459a67893ff5"/>
<SegmentURL media="https://firebasestorage.googleapis.com/v0/b/angar-fashion.appspot.com/o/dash-mpeg%2Fsegment_7.m4s?alt=media&token=c6f820b7-f3f3-4625-b8bd-2118ff7e9635"/>
<SegmentURL media="https://firebasestorage.googleapis.com/v0/b/angar-fashion.appspot.com/o/dash-mpeg%2Fsegment_8.m4s?alt=media&token=99d2b5b4-1746-491d-8f85-7782e5fdf488"/>
</SegmentList>
</Representation>
</AdaptationSet>
</Period>
</MPD>
and I've tried BaseURL tag. But it didn't work too.
<?xml version="1.0"?>
<!-- MPD file Generated with GPAC version 0.8.0-revrelease at 2019-08-06T09:00:00.629Z-->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500S" type="static" mediaPresentationDuration="PT0H0M38.080S" maxSegmentDuration="PT0H0M5.005S" profiles="urn:mpeg:dash:profile:full:2011">
<ProgramInformation moreInformationURL="http://gpac.io">
<Title>try_1.mpd generated by GPAC</Title>
</ProgramInformation>
<BaseURL>https://firebasestorage.googleapis.com/v0/b/angar-fashion.appspot.com/o/</BaseURL>
<Period duration="PT0H0M38.080S">
<AdaptationSet segmentAlignment="true" maxWidth="1280" maxHeight="720" maxFrameRate="24000/1001" par="16:9" lang="und" startWithSAP="1">
<ContentComponent id="1" contentType="video" />
<ContentComponent id="2" contentType="audio" />
<Representation id="1" mimeType="video/mp4" codecs="avc1.64001F,mp4a.40.2" width="1280" height="720" frameRate="24000/1001" sar="1:1" audioSamplingRate="48000" bandwidth="1545875">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
<SegmentList timescale="1000" duration="4000">
<Initialization sourceURL="dash-mpeg%2Fsegment_init.mp4?alt=media&token=52f0a3e4-8994-4538-876e-14aaa4d5ab29"/>
<SegmentURL media="dash-mpeg%2Fsegment_1.m4s?alt=media&token=ec1c7959-3191-4774-8187-ad4f8358a91c"/>
<SegmentURL media="dash-mpeg%2Fsegment_2.m4s?alt=media&token=7cca4f12-c295-45b9-b094-0115f2415c95"/>
<SegmentURL media="dash-mpeg%2Fsegment_3.m4s?alt=media&token=6aef7cb0-a637-4abb-9e92-c9cb44805d27"/>
<SegmentURL media="dash-mpeg%2Fsegment_4.m4s?alt=media&token=01df0576-401d-4b2a-8434-6f11ecdb74bf"/>
<SegmentURL media="dash-mpeg%2Fsegment_5.m4s?alt=media&token=2ec2692f-5178-4b74-bfa8-cf862fc7e2b4"/>
<SegmentURL media="dash-mpeg%2Fsegment_6.m4s?alt=media&token=a18b54ea-2e81-4ec6-8030-459a67893ff5"/>
<SegmentURL media="dash-mpeg%2Fsegment_7.m4s?alt=media&token=c6f820b7-f3f3-4625-b8bd-2118ff7e9635"/>
<SegmentURL media="dash-mpeg%2Fsegment_8.m4s?alt=media&token=99d2b5b4-1746-491d-8f85-7782e5fdf488"/>
</SegmentList>
</Representation>
</AdaptationSet>
</Period>
</MPD>
.mpd file after I changed SegmentURLs and BaseURL is invalid.
& in the URL needs to be escaped as it is a control character in XML.
Replace it with &.
I am taking a wild guess:
This URL is probably incorrect '/' is escaped as %2F
https://firebasestorage.googleapis.com/v0/b/angar-fashion.appspot.com/o/dash-mpeg%2Fsegment_1.m4s?alt=media&token=ec1c7959-3191-4774-8187-ad4f8358a91c
I would try:
https://firebasestorage.googleapis.com/v0/b/angar-fashion.appspot.com/o/dash-mpeg/segment_1.m4s?alt=media&token=ec1c7959-3191-4774-8187-ad4f8358a91c
If changing the URL doesn't work - I would debug your player using something like: https://www.telerik.com/fiddler
as the title says, I can successfully create a new Product via Prestashop 1.6.1 webservice. The problem is that the new product XML has an empty stock_available section:
<stock_availables nodeType="stock_available" api="stock_availables" />
so I have no idea how to set the initial quantity for that product. If I set it manually from the back office, the stock_available section is filled.
Maybe there is something I'm missing in the XML request? Here it is:
<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<product>
<id/>
<id_manufacturer/>
<id_supplier/>
<id_category_default>52</id_category_default>
<new/>
<cache_default_attribute/>
<id_default_image/>
<id_default_combination/>
<id_tax_rules_group/>
<position_in_category/>
<type/>
<id_shop_default/>
<reference>A130</reference>
<supplier_reference/>
<location/>
<width/>
<height/>
<depth/>
<weight/>
<quantity_discount/>
<ean13/>
<upc/>
<cache_is_pack/>
<cache_has_attachments/>
<is_virtual/>
<on_sale/>
<online_only/>
<ecotax/>
<minimal_quantity/>
<price>1.30</price>
<wholesale_price/>
<unity/>
<unit_price_ratio/>
<additional_shipping_cost/>
<customizable/>
<text_fields/>
<uploadable_files/>
<active>1</active>
<redirect_type/>
<id_product_redirected/>
<available_for_order>1</available_for_order>
<available_date/>
<condition/>
<show_price>1</show_price>
<indexed>1</indexed>
<visibility/>
<advanced_stock_management/>
<date_add/>
<date_upd/>
<pack_stock_type/>
<meta_description>
<language id="1" xlink:href="http://www.mysite.it/prestashop/api/languages/1"><![CDATA[product name]]></language>
</meta_description>
<meta_keywords>
<language id="1" xlink:href="http://www.mysite.it/prestashop/api/languages/1"><![CDATA[product name]]></language>
</meta_keywords>
<meta_title>
<language id="1" xlink:href="http://www.mysite.it/prestashop/api/languages/1"><![CDATA[product name]]></language>
</meta_title>
<link_rewrite>
<language id="1" xlink:href="http://www.mysite.it/prestashop/api/languages/1"><![CDATA[product name]]></language>
</link_rewrite>
<name>
<language id="1" xlink:href="http://www.mysite.it/prestashop/api/languages/1"><![CDATA[product name]]></language>
</name>
<description>
<language id="1" xlink:href="http://www.mysite.it/prestashop/api/languages/1"><![CDATA[product name]]></language>
</description>
<description_short>
<language id="1" xlink:href="http://www.mysite.it/prestashop/api/languages/1"><![CDATA[product name]]></language>
</description_short>
<available_now>
<language id="1" xlink:href="http://www.mysite.it/prestashop/api/languages/1"><![CDATA[product name]]></language>
</available_now>
<available_later>
<language id="1" xlink:href="http://www.mysite.it/prestashop/api/languages/1"><![CDATA[available later]]></language>
</available_later>
<associations>
<categories>
<category>
<id/>
</category>
<category>
<id>52</id>
</category>
</categories>
<images>
<image>
<id/>
</image>
</images>
<combinations>
<combination>
<id/>
</combination>
</combinations>
<product_option_values>
<product_option_value>
<id/>
</product_option_value>
</product_option_values>
<product_features>
<product_feature>
<id/>
<id_feature_value/>
</product_feature>
</product_features>
<tags>
<tag>
<id/>
</tag>
</tags>
<stock_availables>
<stock_available>
<id/>
<id_product_attribute/>
</stock_available>
</stock_availables>
<accessories>
<product>
<id/>
</product>
</accessories>
<product_bundle>
<product>
<id/>
<quantity/>
</product>
</product_bundle>
</associations>
</product>
</prestashop>
Thank you for any help!
Iuri
The problem was probably a bug with that version of Prestashop. With the latest version (1.6.1.17) it works correctly.
Here is the sample report
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="sample" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="80b32d69-a3a5-4132-afef-37bc11966113">
<parameter name="img" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZH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AyIC01IGMgMC40MyAtMy42NyAwLjc0IC04LjY3IDAgLTEyIGMgLTAuNDUgLTIgLTIuNDkgLTQuMTggLTQgLTYgYyAtMS43OCAtMi4xNCAtMy43OCAtNC42NCAtNiAtNiBjIC0zLjQgLTIuMDggLTguMDIgLTQuMTUgLTEyIC01IGMgLTQuOTEgLTEuMDUgLTEwLjkgLTAuMyAtMTYgLTEgYyAtMi4wMSAtMC4yNyAtNC4wNyAtMS45IC02IC0yIGMgLTQuMjkgLTAuMjEgLTkuMjYgMC41MyAtMTQgMSBjIC0yLjA2IDAuMjEgLTQuMTEgMC40MSAtNiAxIGMgLTMuMzUgMS4wNSAtNi41MiAyLjkyIC0xMCA0IGMgLTExLjc3IDMuNjYgLTI5LjQzIDcuMyAtMzUgMTAgYyAtMC45NyAwLjQ3IDEuMDcgNC41MiAyIDYgYyAwLjUzIDAuODQgMi4xNyAxLjE3IDMgMiBjIDYuMDEgNi4wMSAxMS41NiAxMy44MSAxOCAxOSBjIDUuMDcgNC4wOCAxMS44MiA3LjEgMTggMTAgYyA0LjQ3IDIuMDkgOS4yOSAzLjk3IDE0IDUgYyA1LjczIDEuMjUgMTEuNzQgMS4zNSAxOCAyIGMgMy44MiAwLjQgNy4yNSAwLjkyIDExIDEgYyAxMy4yNSAwLjI3IDI2LjcyIDEuMTIgMzkgMCBjIDUuMjggLTAuNDggMTAuOTMgLTMuMDcgMTYgLTUgYyAxLjc2IC0wLjY3IDMuODkgLTEuNjkgNSAtMyBjIDIuMjMgLTIuNjMgNC4zNSAtNi41NCA2IC0xMCBjIDEuNjUgLTMuNDcgMy4xMiAtNy40NyA0IC0xMSBjIDAuMzggLTEuNTEgLTAuMzQgLTMuNDUgMCAtNSBjIDAuOTMgLTQuMjEgMy4wNyAtOC43OSA0IC0xMyBsIDAgLTUiLz48L3N2Zz4="]]></defaultValueExpression>
</parameter>
<detail>
<band height="125" splitType="Stretch">
<image hAlign="Left" isUsingCache="true">
<reportElement uuid="80c1fb9b-31c1-4755-941a-f100059e488d" x="11" y="10" width="522" height="83"/>
<imageExpression><![CDATA[$P{img}]]></imageExpression>
</image>
</band>
</detail>
</jasperReport>
It returns the error:
Byte data not found at : data:image/svg+xml;base64, ...
while rendering in PDF, though works only on HTML exports.
As suggested in some posts, I tried using
net.sf.jasperreports.renderers.BatikRenderer.getInstance(new java.net.URL("data:..."))
but it didn't work either.
Could someone suggest a method that will display the embedded image in all types of exports?
I have finally solved problem of embedding SVG in Jasper PDF report.
Use raw SVG image data without data:image/svg+xml;base64.
Use net.sf.jasperreports.renderers.BatikRenderer to render SVG image. Maven dependency including this class is following:
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-bridge</artifactId>
<version>1.7</version>
</dependency>
Use fully qualified class names org.apache.commons.codec.binary.Base64 instead of Base64. Maven dependency including this class is following:
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
Jasper jrxml shold look like this:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="sample" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="80b32d69-a3a5-4132-afef-37bc11966113">
<parameter name="img" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj48c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMD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LTAuNDUgLTIgLTIuNDkgLTQuMTggLTQgLTYgYyAtMS43OCAtMi4xNCAtMy43OCAtNC42NCAtNiAtNiBjIC0zLjQgLTIuMDggLTguMDIgLTQuMTUgLTEyIC01IGMgLTQuOTEgLTEuMDUgLTEwLjkgLTAuMyAtMTYgLTEgYyAtMi4wMSAtMC4yNyAtNC4wNyAtMS45IC02IC0yIGMgLTQuMjkgLTAuMjEgLTkuMjYgMC41MyAtMTQgMSBjIC0yLjA2IDAuMjEgLTQuMTEgMC40MSAtNiAxIGMgLTMuMzUgMS4wNSAtNi41MiAyLjkyIC0xMCA0IGMgLTExLjc3IDMuNjYgLTI5LjQzIDcuMyAtMzUgMTAgYyAtMC45NyAwLjQ3IDEuMDcgNC41MiAyIDYgYyAwLjUzIDAuODQgMi4xNyAxLjE3IDMgMiBjIDYuMDEgNi4wMSAxMS41NiAxMy44MSAxOCAxOSBjIDUuMDcgNC4wOCAxMS44MiA3LjEgMTggMTAgYyA0LjQ3IDIuMDkgOS4yOSAzLjk3IDE0IDUgYyA1LjczIDEuMjUgMTEuNzQgMS4zNSAxOCAyIGMgMy44MiAwLjQgNy4yNSAwLjkyIDExIDEgYyAxMy4yNSAwLjI3IDI2LjcyIDEuMTIgMzkgMCBjIDUuMjggLTAuNDggMTAuOTMgLTMuMDcgMTYgLTUgYyAxLjc2IC0wLjY3IDMuODkgLTEuNjkgNSAtMyBjIDIuMjMgLTIuNjMgNC4zNSAtNi41NCA2IC0xMCBjIDEuNjUgLTMuNDcgMy4xMiAtNy40NyA0IC0xMSBjIDAuMzggLTEuNTEgLTAuMzQgLTMuNDUgMCAtNSBjIDAuOTMgLTQuMjEgMy4wNyAtOC43OSA0IC0xMyBsIDAgLTUiLz48L3N2Zz4="]]></defaultValueExpression>
</parameter>
<detail>
<band height="125" splitType="Stretch">
<image hAlign="Left" isUsingCache="true">
<reportElement uuid="80c1fb9b-31c1-4755-941a-f100059e488d" x="11" y="10" width="522" height="83"/>
<imageExpression><![CDATA[net.sf.jasperreports.renderers.BatikRenderer.getInstance(new org.apache.commons.codec.binary.Base64().decodeBase64($P{img}))]]></imageExpression>
</image>
</band>
</detail>
</jasperReport>
I haven't tried it with a svg but I got it working with a png image.
You have to add the import org.apache.commons.codec.binary.Base64 and you should remove the Header from the base64 encoded data: data:image/svg+xml;base64,
Now you can decode and pass the data with this Expression: new ByteArrayInputStream(new Base64().decodeBase64($P{logo}.getBytes("UTF-8"))).
In your case it should look like this:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="sample" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="80b32d69-a3a5-4132-afef-37bc11966113">
<import value="org.apache.commons.codec.binary.Base64"/>
<parameter name="img" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj48c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmVyc2lvbj0iMS4xIiB3aWR0aD0iMjQ0IiBoZWlnaHQ9IjgyIj48cGF0aCBmaWxsPSJub25lIiBzdHJva2U9IiMwMDAwMDAiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBkPSJNIDEgMzcgYyAwIC0wLjIxIC0wLjUyIC04LjEzIDAgLTEy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SBjIC0yLjA2IDAuMjEgLTQuMTEgMC40MSAtNiAxIGMgLTMuMzUgMS4wNSAtNi41MiAyLjkyIC0xMCA0IGMgLTExLjc3IDMuNjYgLTI5LjQzIDcuMyAtMzUgMTAgYyAtMC45NyAwLjQ3IDEuMDcgNC41MiAyIDYgYyAwLjUzIDAuODQgMi4xNyAxLjE3IDMgMiBjIDYuMDEgNi4wMSAxMS41NiAxMy44MSAxOCAxOSBjIDUuMDcgNC4wOCAxMS44MiA3LjEgMTggMTAgYyA0LjQ3IDIuMDkgOS4yOSAzLjk3IDE0IDUgYyA1LjczIDEuMjUgMTEuNzQgMS4zNSAxOCAyIGMgMy44MiAwLjQgNy4yNSAwLjkyIDExIDEgYyAxMy4yNSAwLjI3IDI2LjcyIDEuMTIgMzkgMCBjIDUuMjggLTAuNDggMTAuOTMgLTMuMDcgMTYgLTUgYyAxLjc2IC0wLjY3IDMuODkgLTEuNjkgNSAtMyBjIDIuMjMgLTIuNjMgNC4zNSAtNi41NCA2IC0xMCBjIDEuNjUgLTMuNDcgMy4xMiAtNy40NyA0IC0xMSBjIDAuMzggLTEuNTEgLTAuMzQgLTMuNDUgMCAtNSBjIDAuOTMgLTQuMjEgMy4wNyAtOC43OSA0IC0xMyBsIDAgLTUiLz48L3N2Zz4="]]></defaultValueExpression>
</parameter>
<detail>
<band height="125" splitType="Stretch">
<image hAlign="Left" isUsingCache="true">
<reportElement uuid="80c1fb9b-31c1-4755-941a-f100059e488d" x="11" y="10" width="522" height="83"/>
<imageExpression><![CDATA[new ByteArrayInputStream(new Base64().decodeBase64($P{img}.getBytes("UTF-8")))]]></imageExpression>
</image>
</band>
</detail>
</jasperReport>
Im trying to stitch together 2 videos, the lead video being landscape and the second being portrait.
However Azure flips the portrait video sideways automatic. is there a way to stop this behaviour? and have the portrait part have black bars to make up the aspect ratio.
The second video is user generated so i have no control as to what size or orientation it will be.
Update 1:
Pre processing the Portrait video through the media service and then stitching the resulting file seems to work. but that makes it a 2 step operation. is there a faster way or is that the solution?
Update 2:
Yes the ones that are flipped are from smartphones
XML
<?xml version="1.0" encoding="utf-16"?>
<Preset
Version="4.0">
<Job />
<MediaFile
DeinterlaceMode="AutoPixelAdaptive"
ResizeQuality="Super"
NormalizeAudio="True"
AudioGainLevel="1"
VideoResizeMode="Stretch">
<Sources>
<Source>
</Source>
<Source
MediaFile="%1%">
</Source>
</Sources>
<OutputFormat>
<MP4OutputFormat
StreamCompatibility="Standard">
<AudioProfile Condition="SourceContainsAudio">
<AacAudioProfile
Codec="AAC"
Channels="2"
BitsPerSample="16"
SamplesPerSecond="44100">
<Bitrate>
<ConstantBitrate
Bitrate="128"
IsTwoPass="False"
BufferWindow="00:00:00" />
</Bitrate>
</AacAudioProfile>
</AudioProfile>
<VideoProfile Condition="SourceContainsVideo">
<MainH264VideoProfile
BFrameCount="3"
EntropyMode="Cabac"
RDOptimizationMode="Quality"
HadamardTransform="True"
SubBlockMotionSearchMode="Quality"
MultiReferenceMotionSearchMode="Quality"
ReferenceBFrames="False"
AdaptiveBFrames="True"
SceneChangeDetector="True"
FastIntraDecisions="False"
FastInterDecisions="False"
SubPixelMode="Quarter"
SliceCount="0"
KeyFrameDistance="00:00:05"
InLoopFilter="True"
MEPartitionLevel="EightByEight"
ReferenceFrames="4"
SearchRange="128"
AutoFit="True"
Force16Pixels="False"
FrameRate="0"
SeparateFilesPerStream="True"
SmoothStreaming="False"
NumberOfEncoderThreads="0">
<Streams
AutoSize="False">
<StreamInfo
Size="1280, 720">
<Bitrate>
<ConstantBitrate
Bitrate="4500"
IsTwoPass="False"
BufferWindow="00:00:05" />
</Bitrate>
</StreamInfo>
</Streams>
</MainH264VideoProfile>
</VideoProfile>
</MP4OutputFormat>
</OutputFormat>
</MediaFile>
</Preset>
Can you please try updating your preset as follows:
<?xml version="1.0" encoding="utf-16"?>
<Presets Rotation="Auto">
<Preset
Version="5.0">
...
</Preset>
</Presets>