FFmpeg git repo
Go to file
Aman Gupta 16b4f97b72 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>
2018-05-18 19:00:29 -07:00
compat compat: remove in-tree NVidia headers 2018-02-27 16:22:12 +01:00
doc avformat/mpegts: add merge_pmt_versions option 2018-05-18 19:00:29 -07:00
ffbuild Merge commit '17b6c7efb471e8ff1b8a7271f6531ba1d52bf69c' 2017-11-12 01:02:02 -03:00
fftools ffprobe: fix SEGV when new streams are added 2018-05-09 12:30:17 -07:00
libavcodec avcodec/videotoolbox: fix decoding of some HEVC videos 2018-05-18 12:38:51 -07:00
libavdevice lavd/v4l2: Add ARGB and XRGB packed pixel formats 2018-05-10 22:40:57 +02:00
libavfilter avfilter/vsrc_testsrc: fix a preprocessor check 2018-05-18 17:42:57 -03:00
libavformat avformat/mpegts: add merge_pmt_versions option 2018-05-18 19:00:29 -07:00
libavresample avresample: remove deprecated attribute from the AVAudioResampleContext struct 2018-01-09 10:56:53 -03:00
libavutil lavu/Makefile: Fix alignment and ordering 2018-05-15 22:16:03 +01:00
libpostproc Bump minor versions after release/4.0 branching 2018-04-16 12:35:12 +02:00
libswresample swresample/arm: rename labels to fix xcode build error 2018-04-28 18:08:52 +02:00
libswscale swscale: add gray14 support 2018-05-05 21:35:31 +02:00
presets
tests avformat/mpegts: add merge_pmt_versions option 2018-05-18 19:00:29 -07:00
tools avcodec: Disable new iterate API for ossfuzz 2018-05-16 00:39:52 +02:00
.gitattributes
.gitignore Remove the ffserver program 2018-01-06 18:31:37 +00:00
.travis.yml Merge commit '4809781586d1c956005f72946a2aab5915eab350' 2017-10-28 15:08:31 -03:00
CONTRIBUTING.md
COPYING.GPLv2
COPYING.GPLv3
COPYING.LGPLv2.1
COPYING.LGPLv3
CREDITS
Changelog avfilter/vsrc_testsrc: add pal75bars and pal100bars video filter sources 2018-05-18 15:39:54 +02:00
INSTALL.md
LICENSE.md Merge commit '4fef648d10bf3bcfd4b8fa5755c1128966a2427c' 2017-03-15 22:07:47 +01:00
MAINTAINERS Add IRC nicknames 2018-05-14 11:36:40 +02:00
Makefile Revert "lavd: add new API for iterating input and output devices" 2018-03-31 23:26:31 +01:00
README.md Remove the ffserver program 2018-01-06 18:31:37 +00:00
RELEASE RELEASE: update for git after 3.4 branchpoint 2017-10-11 02:46:23 +02:00
configure configure: error out on unsupported MSVC versions 2018-05-18 02:22:57 +01:00

README.md

FFmpeg README

FFmpeg is a collection of libraries and tools to process multimedia content such as audio, video, subtitles and related metadata.

Libraries

  • libavcodec provides implementation of a wider range of codecs.
  • libavformat implements streaming protocols, container formats and basic I/O access.
  • libavutil includes hashers, decompressors and miscellaneous utility functions.
  • libavfilter provides a mean to alter decoded Audio and Video through chain of filters.
  • libavdevice provides an abstraction to access capture and playback devices.
  • libswresample implements audio mixing and resampling routines.
  • libswscale implements color conversion and scaling routines.

Tools

  • ffmpeg is a command line toolbox to manipulate, convert and stream multimedia content.
  • ffplay is a minimalistic multimedia player.
  • ffprobe is a simple analysis tool to inspect multimedia content.
  • Additional small tools such as aviocat, ismindex and qt-faststart.

Documentation

The offline documentation is available in the doc/ directory.

The online documentation is available in the main website and in the wiki.

Examples

Coding examples are available in the doc/examples directory.

License

FFmpeg codebase is mainly LGPL-licensed with optional components licensed under GPL. Please refer to the LICENSE file for detailed information.

Contributing

Patches should be submitted to the ffmpeg-devel mailing list using git format-patch or git send-email. Github pull requests should be avoided because they are not part of our review process and will be ignored.