Commit Graph

7002 Commits

Author SHA1 Message Date
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
Aman Gupta 2b2f2f65f3 avformat: add fields to AVProgram/AVStream for PMT change tracking
These fields will allow the mpegts demuxer to expose details about
the PMT/program which created the AVProgram and its AVStreams.

In mpegts, a PMT which advertises streams has a version number
which can be incremented at any time. When the version changes,
the pids which correspond to each of it's streams can also change.

Since ffmpeg creates a new AVStream per pid by default, an API user
needs the ability to (a) detect when the PMT changed, and (b) tell
which AVStream were added to replace earlier streams.

This has been a long-standing issue with ffmpeg's handling of mpegts
streams with PMT changes, and I found two related patches in the wild
that attempt to solve the same problem:

The first is in MythTV's ffmpeg fork, where they added a
void (*streams_changed)(void*); to AVFormatContext and call it from
their fork of the mpegts demuxer whenever the PMT changes.

The second was proposed by XBMC in
https://ffmpeg.org/pipermail/ffmpeg-devel/2012-December/135036.html,
where they created a new AVMEDIA_TYPE_DATA stream with id=0 and
attempted to send packets to it whenever the PMT changed.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2018-05-18 19:00:29 -07:00
Aman Gupta e24d768a76 avformat/mpegts: add skip_unknown_pmt option
Some filtered mpegts streams may erroneously include PMTs for
programs that are not advertised in the PAT. This confuses ffmpeg
and most players because multiple audio/video streams are created
and it is unclear which ones actually contain data.

See for example https://tmm1.s3.amazonaws.com/unknown-pmts.ts

In this sample, the PAT advertises exactly one program. But the
pid it points to for the program's PMT contains PMTs for other
programs as well. This is because the broadcaster decided to
re-use the same pid for multiple program PMTs.

The hardware that filtered the original multi-program stream
into a single-program stream did so by rewriting the PAT to
contain only the program that was requested. But since it just
passed through the PMT pid referenced in the PAT, multiple PMTs
are still present for the other programs.

Before:

    Input #0, mpegts, from 'unknown-pmts.ts':
      Duration: 00:00:10.11, start: 80741.189700, bitrate: 9655 kb/s
      Program 4
        Stream #0:2[0x41]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], Closed Captions, 11063 kb/s, 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
        Stream #0:3[0x44](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 384 kb/s
        Stream #0:4[0x45](spa): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 128 kb/s
      No Program
        Stream #0:0[0x31]: Video: mpeg2video ([2][0][0][0] / 0x0002), none(tv), 90k tbr, 90k tbn, 90k tbc
        Stream #0:1[0x34](eng): Audio: ac3 (AC-3 / 0x332D4341), 0 channels, fltp
        Stream #0:5[0x51]: Video: mpeg2video ([2][0][0][0] / 0x0002), none, 90k tbr, 90k tbn
        Stream #0:6[0x54](eng): Audio: ac3 (AC-3 / 0x332D4341), 0 channels

With skip_unknown_pmt=1:

    Input #0, mpegts, from 'unknown-pmts.ts':
      Duration: 00:00:10.11, start: 80741.189700, bitrate: 9655 kb/s
      Program 4
        Stream #0:0[0x41]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], Closed Captions, 11063 kb/s, 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
        Stream #0:1[0x44](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 384 kb/s
        Stream #0:2[0x45](spa): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 128 kb/s

Signed-off-by: Aman Gupta <aman@tmm1.net>
2018-05-18 12:04:57 -07:00
Tobias Rapp eb28b5ec8a avfilter/vsrc_testsrc: add pal75bars and pal100bars video filter sources
Generates color bar test patterns based on EBU PAL recommendations.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2018-05-18 15:39:54 +02:00
Rostislav Pehlivanov 62a7a70484 doc/developer: update style guidelines to include for loops with declarations
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2018-05-18 02:24:28 +01:00
Rostislav Pehlivanov ce943dd6ac configure: error out on unsupported MSVC versions
The FATE tests for MSVC versions older than 2013 are untested in FATE
and apparently are no longer supported.

This commit makes the configure process error out in case an older version
is used, and suggests to use a supported version of MSVC to compile.

This also changes the documentation to reflect this.

As discussed on IRC:

2018-05-12 19:45:16     jamrial then again, most of those were for old msvc, and i think we're not supporting versions older than 2013 (first one c99 compliant) anymore
2018-05-12 19:45:43     +JEEB   yea, I think 2013 update 2 is needed

22:53 <@atomnuker> nevcairiel: which commit broke/unsupported support for msvc 2013?
23:23 <@atomnuker> okay, it was JEEB
23:25 <+JEEB> which was for 2012 and older
23:25 <+JEEB> and IIRC we no longer test those in FATE so that was my assumption
23:26 <+JEEB> 2013 is when MS got trolled enough to actually update their C part
23:26 <+JEEB> aand actually advertised FFmpeg support
23:26 <+JEEB> (although it was semi-failing until VS2013 update 1 or 2)

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2018-05-18 02:22:57 +01:00
Aman Gupta 5dfeb7f081 avformat/mpegts: tag video streams with still images
Parses the video_stream_descriptor (H.222 2.6.2) to look
for the still_picture_flag. This is exposed to the user
via a new AV_DISPOSITION_STILL_IMAGE.

See for example https://tmm1.s3.amazonaws.com/music-choice.ts,
whose video stream only updates every ~6 seconds.

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-17 12:03:22 -07:00
Paul B Mahol 4e816b5491 avfilter: add aderivative and aintegral filter
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-16 12:20:38 +02:00
Zhao Zhili d0b5952325 doc/examples: add missing ignore files
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-16 00:39:52 +02:00
Zhao Zhili f24b2e64b0 examples/filtering_video: fix memory leak
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-16 00:39:52 +02:00
Zhao Zhili c0a845f948 examples/filtering_video: add missing headers
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-16 00:39:52 +02:00
Zhao Zhili 84d4af4ea8 examples/filtering_video: drop an always true condition
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-16 00:39:52 +02:00
Vishwanath Dixit e3518821c9 avformat/dashenc: configuring container format options 2018-05-15 11:13:36 +05:30
Karthick Jeyapal c76a6c93bf avformat/dashenc: Add documentation for http method option 2018-05-14 10:20:54 +05:30
Aman Gupta cae004cabb doc: fix incorrect reference to xsd_compliant option
reported by Mindless` on IRC
2018-05-12 12:09:20 -07:00
Paul B Mahol 974eb4aaaa avfilter: add fftdnoiz filter
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-10 14:44:17 +02:00
Timo Rothenpieler c855683427 avutil/hwcontext_cuda: add CUstream in cuda hwctx 2018-05-10 00:34:22 +02:00
Marton Balint 03038d4da9 avcodec/libzvbi-teletextdec: allow -1 subtitle duration and make it the default
Most decoders (pgssubdec, ccaption_dec) are using -1 or UINT32_MAX for a
subtitle event which should be cleared at the next event.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-05-06 21:57:22 +02:00
Paul B Mahol 0bcc66571a avfilter/vf_edgedetect: add planes option
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-04 21:37:33 +02:00
Paul B Mahol d122c8b102 avfilter/vf_edgedetect: add canny mode
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-04 21:34:49 +02:00
Paul B Mahol aba39cc1f1 avfilter/vf_convolution: add column/vertical mode
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-04 21:32:26 +02:00
Paul B Mahol 4bad76b6e9 avfilter/vf_amplify: add more options for finer filtering
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-04 14:41:38 +02:00
Paul B Mahol 3a96534ed9 avfilter/vf_convolution: add horizontal/row mode
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-03 10:55:10 +02:00
Mark Thompson 308b989e0c lavc: Add VP9 metadata bitstream filter
Can adjust the colour information.
2018-05-02 01:21:40 +01:00
Mark Thompson b5df289eb7 lavc: Add coded bitstream read/write support for VP9 2018-05-02 01:21:33 +01:00
Marton Balint 56b081da57 avutil/pixdesc: add AV_PIX_FMT_FLAG_ALPHA to AV_PIX_FMT_PAL8
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-04-30 21:51:31 +02:00
Paul B Mahol 02470814b5 doc/filters: add tmix examples
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-29 19:36:25 +02:00
Paul B Mahol c0f2abcc8d avfilter/vf_mix: make setting weights more user friendly
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-29 19:27:15 +02:00
Paul B Mahol 889d858491 avfilter: add amplify filter
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-29 13:24:50 +02:00
Gyan Doshi 96d7cbedbe doc/ffmpeg - update benchmark option readout details
-benchmark and -benchmark_all now show real, system and user time
2018-04-28 22:51:04 +05:30
Paul B Mahol c116ba375e doc/libav-merge: remove resolved item
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-28 14:15:41 +02:00
Paul B Mahol 4f484edaa7 avfilter/vf_convolution: make rdiv set to 0 more useful
Use 0 for signaling that rdiv will be calculated from sum
of all matrix elements.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-28 11:25:43 +02:00
Paul B Mahol 356a33b20a avfilter/vf_atadenoise: do not abort if user specified invalid size
Update documentation with new size default.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-26 22:25:10 +02:00
Clément Bœsch 5be0410cb3 lavu/opt: add AV_OPT_FLAG_DEPRECATED 2018-04-26 19:50:29 +02:00
Clément Bœsch 71fa82bed6 lavu/threadmessage: add av_thread_message_queue_nb_elems() 2018-04-26 19:41:19 +02:00
Paul B Mahol a5172dcab6 avfilter/vf_mix: add scale option
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-26 16:44:15 +02:00
Paul B Mahol 161e006cc0 avfilter: add tmix filter
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-26 16:44:15 +02:00
Jun Zhao f97fa89925 doc/examples/filtering_audio: Remove setting deprecated refcounted_frames
When use new decode APIs(avcodec_send_packet/avcodec_receive_frame),
don't need to setting the deprecated field refcounted_frames.

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-04-22 15:39:22 +08:00
Jun Zhao 0c28a5cf0f doc/examples/filtering_video: Remove setting deprecated refcounted_frames
When use new decode APIs(avcodec_send_packet/avcodec_receive_frame),
don't need to setting the deprecated field refcounted_frames.

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-04-22 15:38:40 +08:00
Jun Zhao c6d8492cff doc/examples/hw_decode: Remove setting deprecated refcounted_frames
When use new decode APIs(avcodec_send_packet/avcodec_receive_frame),
don't need to setting the deprecated field refcounted_frames.

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-04-22 15:37:25 +08:00
Paul B Mahol 21da248b5f avfilter: add deblock filter
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-21 11:34:49 +02:00
Gyan Doshi 424836505f doc/muxers: tee muxer - rearrange, add notes and general tidy-up 2018-04-19 17:43:42 +05:30
Paul B Mahol 2fc12f4971 avfilter: add lowshelf and highshelf filters
These are old bass and treble filters.
Make bass and treble filters better at boosting.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-17 12:40:27 +02:00
Vishwanath Dixit d10cefbfe5 avformat/dashenc: addition of segment index correction logic
The logic is applicable only when use_template is enabled and use_timeline
is disabled. The logic monitors the flow of segment indexes. If a streams's
segment index value is not at the expected real time position, then
the logic corrects that index value.

Typically this logic is needed in live streaming use cases. The network
bandwidth fluctuations are common during long run streaming. Each
fluctuation can cause the segment indexes fall behind the expected real
time position. Without this logic, players will not be able to consume
the content, even after encoder's network condition comes back to
normal state.
2018-04-17 14:35:40 +05:30
Vishwanath Dixit ab789e184c avformat/dashenc: segmentation at the configured segment duration rate
When use_template is enabled and use_timeline is disabled, typically
it is required to generate the segments at the configured segment duration
rate on an average. This commit is particularly needed to handle the
segmentation when video frame rates are fractional like 29.97 or 59.94 fps.
2018-04-17 14:31:22 +05:30
Vishwanath Dixit 01ba52852d avformat/dashenc: replacing 'min_seg_duration' with 'seg_duration'
There are use cases where average segment duration needs to be configured
and muxer is expected to maintain the average segment duration. So, using
the name 'min_seg_duration' will be misleading. So, changing the parameter
name to 'seg_duration', where it can be minimum segment duration or average
segment duration based on the use-case. The additional updates needed for
this functinality are made the sub-sequent patches of this patch series.
2018-04-17 14:30:47 +05:30
Michael Niedermayer ec8a5262b0 doc/APIchanges: Fix typos in hashes
Thanks-to: Moritz Barsnick <barsnick@gmx.net> for finding the correct ones

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-16 19:24:31 +02:00
Paul B Mahol 6e05a11e89 avfilter/af_afir: make max IR length configurable
Also increase max allowed dry/wet value.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-16 19:11:35 +02:00
Michael Niedermayer 1b7b7c6a62 doc/APIchanges: Add 4.0 cut point
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-16 12:35:12 +02:00
Michael Niedermayer e8be46dfe0 doc/APIchanges: Fill in missing stuff
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-16 12:35:12 +02:00