diff options
author | Aman Gupta <aman@tmm1.net> | 2018-05-09 02:12:12 +0300 |
---|---|---|
committer | Aman Gupta <aman@tmm1.net> | 2018-05-19 05:00:29 +0300 |
commit | 16b4f97b721dfb1118c5c0acb03e6a4e80726179 (patch) | |
tree | 2ce2abcc9f7d74ad4fd904e083958b7c5bc07179 /tests/ref | |
parent | 24579bf53747176bc288fdcca98d1f3209099ade (diff) |
avformat/mpegts: add merge_pmt_versions option
This new optional flag makes it easier to deal with mpegts
samples where the PMT is updated and elementary streams move
to different PIDs in the middle of playback.
Previously, new AVStreams were created per PID, and it was up
to the user to figure out which streams had migrated to a new PID
(by iterating over the list of AVProgram and making guesses), and
switch seamlessly to the new AVStream during playback.
Transcoding or remuxing these streams with ffmpeg on the CLI was
also quite painful, and the user would need to extract each set
of PIDs into a separate file and then stitch them back together.
With this new option, the mpegts demuxer will automatically detect
PMT changes and feed data from the new PID to the original AVStream
that was created for the orignal PID. For mpegts samples with
stream_identifier_descriptor available, the unique ID is used to
merge PIDs together. If the stream id is not available, the demuxer
attempts to map PIDs based on their position within the PMT.
With this change, I am able to playback and transcode/remux these
two samples which previously caused issues:
https://tmm1.s3.amazonaws.com/pmt-version-change.ts
https://kuroko.fushizen.eu/videos/pid_switch_sample.ts
I also have another longer sample in which the PMT changes
repeatedly and ES streams move to different pids three times
during playback:
https://tmm1.s3.amazonaws.com/multiple-pmt-change.ts
Demuxing this sample with the new option shows several new log
messages as the PMT changes are handled:
[mpegts] detected PMT change (program=1, version=3/6, pcr_pid=0xf98/0xfb7)
[mpegts] re-using existing video stream 0 (pid=0xf98) for new pid=0xfb7
[mpegts] re-using existing audio stream 1 (pid=0xf99) for new pid=0xfb8
[mpegts] re-using existing audio stream 2 (pid=0xf9a) for new pid=0xfb9
[mpegts] detected PMT change (program=1, version=6/3, pcr_pid=0xfb7/0xf98)
[mpegts] detected PMT change (program=1, version=3/4, pcr_pid=0xf98/0xf9b)
[mpegts] re-using existing video stream 0 (pid=0xf98) for new pid=0xf9b
[mpegts] re-using existing audio stream 1 (pid=0xf99) for new pid=0xf9c
[mpegts] re-using existing audio stream 2 (pid=0xf9a) for new pid=0xf9d
[mpegts] detected PMT change (program=1, version=4/5, pcr_pid=0xf9b/0xfa9)
[mpegts] re-using existing video stream 0 (pid=0xf98) for new pid=0xfa9
[mpegts] re-using existing audio stream 1 (pid=0xf99) for new pid=0xfaa
[mpegts] re-using existing audio stream 2 (pid=0xf9a) for new pid=0xfab
[mpegts] detected PMT change (program=1, version=5/6, pcr_pid=0xfa9/0xfb7)
Signed-off-by: Aman Gupta <aman@tmm1.net>
Diffstat (limited to 'tests/ref')
-rw-r--r-- | tests/ref/fate/mpegts-probe-pmt-merge | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/ref/fate/mpegts-probe-pmt-merge b/tests/ref/fate/mpegts-probe-pmt-merge new file mode 100644 index 0000000000..6e424af5d2 --- /dev/null +++ b/tests/ref/fate/mpegts-probe-pmt-merge @@ -0,0 +1,32 @@ +[PROGRAM] +[STREAM] +codec_name=ac3 +[/STREAM] +[STREAM] +codec_name=ac3 +[/STREAM] +[STREAM] +codec_name=ac3 +[/STREAM] +[STREAM] +codec_name=mpeg2video +[/STREAM] +[STREAM] +codec_name=scte_35 +[/STREAM] +[/PROGRAM] +[STREAM] +codec_name=ac3 +[/STREAM] +[STREAM] +codec_name=ac3 +[/STREAM] +[STREAM] +codec_name=ac3 +[/STREAM] +[STREAM] +codec_name=mpeg2video +[/STREAM] +[STREAM] +codec_name=scte_35 +[/STREAM] |