shaka-project / shaka-packager

A media packaging and development framework for VOD and Live DASH and HLS applications, supporting Common Encryption for Widevine and other DRM Systems.
https://shaka-project.github.io/shaka-packager/
Other
1.9k stars 496 forks source link

[DASH] Duplicated Representation id when --force_cl_index + passthrough TTML inputs #1362

Closed unext-wendong closed 3 months ago

unext-wendong commented 3 months ago

System info

Operating System: macOS Ventura 13.2.1 (Apple Silicon) Shaka Packager Version: v3.0.1

Used docker image from here: https://hub.docker.com/r/google/shaka-packager/tags Tag: v3.0.1

Issue and steps to reproduce the problem

Packager Command:

docker run --rm \
    -v <input-dir>:/input \
    -v <output-dir>:/output \
    google/shaka-packager:v3.0.1 \
    packager \
    in="/input/audio.mp4",stream=audio,output="/output/audio.mp4",language="en" \
    in="/input/video.mp4",stream=video,output="/output/video.mp4" \
    in="/input/subtitle_ttml.xml",stream=text,output="/output/text.ttml",language="en-US",dash_roles="subtitle" \
    --mpd_output /output/manifest.mpd

What is the expected result? The generated mod file has 3 Representation elements each with a unique id value.

Per the DASH spec, the Representation id should be unique per Period in most of the cases.

specifies an identifier for this Representation. The identifier shall be unique within a Period unless the Representation is functionally identically to another Representation in the same Period.

What happens instead? The generated mod file has 3 Representation elements two of which have the same id "0". This is the generated mpd file: manifest.mpd.txt

Input files It doesn't seem to be specific to a particular set of inputs. As long as there is one passthrough TTML that is listed after the audio and video in the command line, it will happen.

But these are the files I used. audio: https://storage.googleapis.com/wvmedia/clear/h264/tears/tears_audio_eng.mp4 (download it to your local) video: https://storage.googleapis.com/wvmedia/clear/h264/tears/tears_h264_baseline_240p_800.mp4 (download it to your local) text: ph.xml.txt (rename it to .xml)

Additional observations

It's likely to be related to the option --force_cl_index. After setting this option to false it will not reproduce.

docker run --rm \
    -v <input-dir>:/input \
    -v <output-dir>:/output \
    google/shaka-packager:v3.0.1 \
    packager \
    in="/input/audio.mp4",stream=audio,output="/output/audio.mp4",language="en" \
    in="/input/video.mp4",stream=video,output="/output/video.mp4" \
    in="/input/subtitle_ttml.xml",stream=text,output="/output/text.ttml",language="en-US",dash_roles="subtitle" \
    --mpd_output /output/manifest.mpd \
    --force_cl_index=false

It's also related to the position of the passthrough TTML input in the command line, if it's in front of the audio and video inputs, it will also not reproduce.

docker run --rm \
    -v <input-dir>:/input \
    -v <output-dir>:/output \
    google/shaka-packager:v3.0.1 \
    packager \
    in="/input/subtitle_ttml.xml",stream=text,output="/output/text.ttml",language="en-US",dash_roles="subtitle" \
    in="/input/audio.mp4",stream=audio,output="/output/audio.mp4",language="en" \
    in="/input/video.mp4",stream=video,output="/output/video.mp4" \
    --mpd_output /output/manifest.mpd
cosmin commented 3 months ago

The problem is we're losing the index for the subtitle streams in StreamInfoToTextMediaInfo, pull request incoming shortly