shaka-packager icon indicating copy to clipboard operation
shaka-packager copied to clipboard

Packaging to DASH does not work when output filename contains an ampersand (unterminated entity reference)

Open andrej-peterka opened this issue 2 years ago • 0 comments

System info

Operating System: macOS Monterey 12.6 Shaka Packager Version: v2.6.1-634af65-release

Issue and steps to reproduce the problem

When packaging to DASH and the output filename contains an ampersand (&), an unterminated entity reference error is printed. Packaging completes, but the resulting MPD manifest is invalid.

Packager Command: Working: packager-osx "input=SampleVideo.mp4,output=Sample_Video.mp4,output_format=mp4,stream_selector=video" -mpd_output manifest_ok.mpd

Not working: packager-osx "input=SampleVideo.mp4,output=Sample&Video.mp4,output_format=mp4,stream_selector=video" -mpd_output manifest_nok.mpd

[1020/191510:INFO:demuxer.cc(89)] Demuxer::Run() on file 'SampleVideo.mp4'.
[1020/191510:INFO:demuxer.cc(155)] Initialize Demuxer for file 'SampleVideo.mp4'.
[1020/191510:INFO:single_segment_segmenter.cc(111)] Update media header (moov) and rewrite the file to 'Sample&Video.mp4'.
error : unterminated entity reference       Video.mp4
[1020/191511:INFO:mp4_muxer.cc(186)] MP4 file 'Sample&Video.mp4' finalized.
error : unterminated entity reference       Video.mp4
Packaging completed successfully.

Diff of the manifests:

diff manifest_ok.mpd manifest_nok.mpd
7c7
<         <BaseURL>Sample_Video.mp4</BaseURL>
---
>         <BaseURL/>

Extra steps to reproduce the problem? (1) Package any video to DASH and set the output video filename to something containing an ampersand (&) (2) Check the manifest

What is the expected result? A manifest with filename filled out at BaseURL.

What happens instead? The resulting manifest has an empty BaseURL

Additionally, if you run the following command: packager-osx "input=SampleVideo.mp4,output=Sample&amp;Video.mp4,output_format=mp4,stream_selector=video" -mpd_output manifest_nok2.mpd

The BaseURL looks like....

<BaseURL>Sample&amp;Video.mp4</BaseURL>

But the resulting file has a filename Sample&amp;Video.mp4

andrej-peterka avatar Oct 20 '22 17:10 andrej-peterka