mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-26 09:12:33 +00:00
16b4f97b72
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>
26 lines
998 B
Makefile
26 lines
998 B
Makefile
#
|
|
# Test probing MPEGTS format and codecs
|
|
#
|
|
PROBE_CODEC_NAME_COMMAND = \
|
|
ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream=codec_name \
|
|
-print_format default -bitexact -v 0
|
|
|
|
FATE_MPEGTS_PROBE-$(call DEMDEC, MPEGTS, HEVC, AAC_LATM) += fate-mpegts-probe-latm
|
|
fate-mpegts-probe-latm: SRC = $(TARGET_SAMPLES)/mpegts/loewe.ts
|
|
fate-mpegts-probe-latm: CMD = run $(PROBE_CODEC_NAME_COMMAND) -i "$(SRC)"
|
|
|
|
|
|
FATE_MPEGTS_PROBE-$(call DEMDEC, MPEGTS, HEVC, AAC_LATM) += fate-mpegts-probe-program
|
|
fate-mpegts-probe-program: SRC = $(TARGET_SAMPLES)/mpegts/loewe.ts
|
|
fate-mpegts-probe-program: CMD = run $(PROBE_CODEC_NAME_COMMAND) -select_streams p:769:v:0 -i "$(SRC)"
|
|
|
|
|
|
FATE_MPEGTS_PROBE-$(call DEMDEC, MPEGTS) += fate-mpegts-probe-pmt-merge
|
|
fate-mpegts-probe-pmt-merge: SRC = $(TARGET_SAMPLES)/mpegts/pmtchange.ts
|
|
fate-mpegts-probe-pmt-merge: CMD = run $(PROBE_CODEC_NAME_COMMAND) -merge_pmt_versions 1 -i "$(SRC)"
|
|
|
|
|
|
FATE_SAMPLES_FFPROBE += $(FATE_MPEGTS_PROBE-yes)
|
|
|
|
fate-mpegts: $(FATE_MPEGTS_PROBE-yes)
|