summaryrefslogtreecommitdiff
path: root/libavformat/mpegtsenc.c
Commit message (Collapse)AuthorAge
...
* avformat/mpegtsenc: set priority flag for AC3 codecs if writing BluRayMarton Balint2019-12-03
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: allow any sensible PID for elementary and PMT PIDsMarton Balint2019-12-03
| | | | | | | | | | | | | This sets the range of the first automatically assigned PMT PID or elementary stream PID parameters to [0x20, 0x1ffa]. You can still assign manually a PID for a stream using AVStream->id in the wider [0x10, 0x1ffe] range as specified by ISO13818-1. But since DVB and ATSC both reserves some PIDs, let's not allow them to be automatically assigned. Also make sure that assigned PID numbers are valid and fix the error message for the previous PID collision checks. Signed-off-by: Marton Balint <cus@passwd.hu>
* lavf/mpegtsenc: fix logic check errorJun Zhao2019-11-04
| | | | | | | | | fix the logic check error fix #6751 Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* avformat/mpegtsenc: fix flushing of audio packetsMarton Balint2019-09-02
| | | | | | | | | | | | | | | | | | | | | | | | 7d097a0fc57f0fa8385962a539c657c2f40b5ed0 had the same purpose as 3700f655c55e2001b57215210b957b169d66b50f but the former is much simpler, so let's remove the latter. Unfortunately both checks were wrong, because in order to make sure DTS > PCR we have to give us some headroom, so instead of using a dts_difference < max_delay check let's use a dts_difference < max_delay/2 check. Fixes DTS < PCR errors with this command line: ./ffmpeg -loglevel verbose -y -f lavfi -i \ "testsrc=s=64x64:d=20,split=2[out0][tmp1];[tmp1]vflip[out1];sine=d=20,asetnsamples=1000[out2]" \ -flags +bitexact -fflags +bitexact -sws_flags +accurate_rnd+bitexact \ -codec:v libx264 -codec:a mp2 -b:a 32k -pix_fmt yuv420p \ -map '0:v:0' \ -map '0:v:1' \ -map '0:a:0' \ -muxrate 800000 \ -program st=0:st=2 -program st=1:st=2 -program st=2 -program st=0 -f mpegts out1.ts Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: get rid of packet counting for sdt/pat/pmtMarton Balint2019-08-23
| | | | | | | | | | | | | The packet counting based approach caused excessive sdt/pat/pmt for VBR, so let's use a timestamp based approach instead similar to how we emit PCRs. SDT/PAT/PMT period should be consistent for both VBR and CBR from now on. Also change the type of sdt_period and pat_period to AV_OPT_TYPE_DURATION so no floating point math is necessary. Fixes ticket #3714. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: move some code around and simplify a bitMarton Balint2019-08-23
| | | | | | | PCR does not need to be recalcualted for CBR when inserting a NULL or PCR only packet. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: add support for setting PCR interval for VBR streamsMarton Balint2019-08-23
| | | | | | | | Also document the algorithm for the default PCR interval. Fixes ticket #8061. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: rename pcr_period variable to pcr_period_msMarton Balint2019-08-23
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: remove deprecated resend_headers optionMarton Balint2019-08-14
| | | | | | Deprecated since 2014. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: fix PCR generation intervalsMarton Balint2019-08-14
| | | | | | | | | | | | | | | | | | | | | | | | PCR generation was based on counting packets for both CBR and VBR streams. Couting packets might have worked for CBR streams (when muxrate was specified) but it only took into account the packets of a service (or the packets of the PCR stream lately), so even that was problematic for multi program streams. The new code works on actual timestamps for both CBR and VBR streams. For VBR streams the behaviour of the old code is simulated by selecting a PCR interval which is the highest multiple of the frame duration but still less than 100 ms. It should be trivial to add support for setting the PCR interval for VBR streams as well in a later patch. The accuracy of PCR packets for CBR streams was greatly improved by preemtively sending them at PCR intervals even if sending the payload of another stream is in progress. This may fix these tickets: - #5750 - #7524 Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: use increasing numbers in default service namesMarton Balint2019-08-14
| | | | | | Maybe we should use service ID instead of increasing numbers? Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: remove section_write_packet forward declarationMarton Balint2019-08-14
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: factorize setting up servicesMarton Balint2019-08-14
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: fix incorrect PCR selection with multiple programsMarton Balint2019-08-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MPEG-TS muxer had a serious bug related to the use of multiple programs: in that case, the PCR pid selection was incomplete for all services except one. This patch solves this problem and selects a stream to become PCR for each service, preferably the video stream. This patch also moves pcr calculation attributes to MpegTSWriteStream from MpegTSService. PCR is a per-stream and not per-service thing, so it was misleading to refer to it as something that is per-service. Also remove *service from MpegTSWriteStream because a stream can belong to multiple services so it was misleading to select one for each stream. You can check the result with this example command: ./ffmpeg -loglevel verbose -y -f lavfi -i \ "testsrc=s=64x64:d=10,split=2[out0][tmp1];[tmp1]vflip[out1];sine=d=10,asetnsamples=1152[out2]" \ -flags +bitexact -fflags +bitexact -sws_flags +accurate_rnd+bitexact \ -codec:v libx264 -codec:a mp2 -pix_fmt yuv420p \ -map '0:v:0' \ -map '0:v:1' \ -map '0:a:0' \ -program st=0:st=2 -program st=1:st=2 -program st=2 -program st=0 -f mpegts out.ts You should now see this: [mpegts @ 0x37505c0] service 1 using PCR in pid=256 [mpegts @ 0x37505c0] service 2 using PCR in pid=257 [mpegts @ 0x37505c0] service 3 using PCR in pid=258 [mpegts @ 0x37505c0] service 4 using PCR in pid=256 Fixes ticket #8039. v2: a video is stream is preferred if there are no programs, just like before the patch. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: write format_identifier HEVC for HEVC streamsMarton Balint2019-03-01
| | | | | | | | | | | | | This improves compatibility with some consumer (LG WebOS) TVs which apparently search a HEVC descriptor (which our mpegts muxer can't generate) or a format identifier. Since the HEVC format identifier is not registered (but used in the wild), it is not written if strict_std_compliance is higher than normal. This fixes the issue in ticket #7744. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: factorize writing registration_descriptorMarton Balint2019-03-01
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: add support for service and provider names with utf8 ↵Marton Balint2019-02-21
| | | | | | encoding Signed-off-by: Marton Balint <cus@passwd.hu>
* Fix bug in mpegts muxer which affects KLV async stream generation.Artyom Lebedev2018-12-08
| | | | | | Fixes ticket #7597. Signed-off-by: Peter Ross <pross@xvid.org>
* avformat/mpegtsenc: set AVFMT_NODIMENSIONSAman Gupta2018-05-12
| | | | | | | | | This allows remuxing streams from one mpegts container to another, without requiring avformat_find_stream_info() (or using `ffmpeg -probesize 32` on the cli). Signed-off-by: Aman Gupta <aman@tmm1.net> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat: migrate to AVFormatContext->urlMarton Balint2018-01-28
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* mpegtsenc: Don't pass NULL to memcpyDerek Buitenhuis2017-07-06
| | | | Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* Fix all -Wformat warnings raised by DJGPPClément Bœsch2017-03-29
|
* lavf/mpegtsenc: clarify pcr_period unit of measurementLou Logan2017-03-16
| | | | | | pcr_period is in milliseconds. Signed-off-by: Lou Logan <lou@lrcd.com>
* libavformat/mpegtsenc: support hevc with missing in stream headers like h.264Michael Niedermayer2017-01-17
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/mpegtsenc: write metadata descriptor for timed ID3 packetsStefano Sabatini2016-11-06
| | | | | | | | This is required since some programs are not able to correctly recognize the metadata. See H.222, 2.6.58 Metadata pointer descriptor. putstr8() is modified in order to allow to skip writing the string length.
* lavf/mpegtsenc: move putstr8 definition upStefano Sabatini2016-11-06
| | | | This allows to use the function in a future commit.
* avformat/mpegtsenc: Add option to mark stream begin as discontinuousMichael Niedermayer2016-11-02
| | | | | | | This avoids continuity check failures in concatenated streams Reviewed-by: Steven Liu <lingjiujianke@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/mpegtsenc: fix autobsf when the first NAL is 0x1<XX> bytesRodger Combs2016-10-04
|
* lavf/mpegtsenc: Set min PID for data pkt to 0x0010.Sylvain Laurent2016-09-28
| | | | Fixes ticket #1673.
* lavf/mpegtsenc: add special case for handling timed ID3 packetsStefano Sabatini2016-07-29
| | | | | | Set the stream_id to 0xbd (private_stream_id_1). Tools seem to assume that value, and this is consistent with MPEG TS specification (ITU-T H.222.0 section 2.12.3).
* Merge commit '393596f9d51134d6e45d81ae129223f4faea1232'Clément Bœsch2016-06-23
|\ | | | | | | | | | | | | | | | | | | | | * commit '393596f9d51134d6e45d81ae129223f4faea1232': mpegtsenc: stop impersonating ses in sdt This commit also includes the needed FATE updates later spotted by Martin Storsjö and fixed in 34effe816f9f3df2e6b8bc738e2b5a86a24fd0d7 on Libav side. Merged-by: Clément Bœsch <u@pkh.me>
| * mpegtsenc: stop impersonating ses in sdtFrancois Cartegnie2016-05-17
| | | | | | | | | | | | | | Unless specified, users must use non registered range for network id Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* | Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'Clément Bœsch2016-06-21
|\| | | | | | | | | | | | | * commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb': cosmetics: Fix spelling mistakes Merged-by: Clément Bœsch <u@pkh.me>
| * cosmetics: Fix spelling mistakesVittorio Giovara2016-05-04
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | lavf/mpegtsenc: set metadata stream type and write descriptor for ID3 packetsStefano Sabatini2016-05-19
| | | | | | | | This allow to remux data packets which are then recognized as ID3 packets.
* | avformat/mpegtsenc: fix usage of AVStream.codecJames Almer2016-05-04
| | | | | | | | Signed-off-by: James Almer <jamrial@gmail.com>
* | lavf/mpegtsenc: Define service_type "HEVC digital television service".smallishzulu2016-05-03
| | | | | | | | Fixes ticket #5455.
* | lavf/mpegtsenc: Fix stream_type for low sample rate MP2/MP3.Carl Eugen Hoyos2016-05-03
| |
* | Merge commit '9200514ad8717c63f82101dc394f4378854325bf'Derek Buitenhuis2016-04-10
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '9200514ad8717c63f82101dc394f4378854325bf': lavf: replace AVStream.codec with AVStream.codecpar This has been a HUGE effort from: - Derek Buitenhuis <derek.buitenhuis@gmail.com> - Hendrik Leppkes <h.leppkes@gmail.com> - wm4 <nfxjfg@googlemail.com> - Clément Bœsch <clement@stupeflix.com> - James Almer <jamrial@gmail.com> - Michael Niedermayer <michael@niedermayer.cc> - Rostislav Pehlivanov <atomnuker@gmail.com> Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * lavf: replace AVStream.codec with AVStream.codecparAnton Khirnov2016-02-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, AVStream contains an embedded AVCodecContext instance, which is used by demuxers to export stream parameters to the caller and by muxers to receive stream parameters from the caller. It is also used internally as the codec context that is passed to parsers. In addition, it is also widely used by the callers as the decoding (when demuxer) or encoding (when muxing) context, though this has been officially discouraged since Libav 11. There are multiple important problems with this approach: - the fields in AVCodecContext are in general one of * stream parameters * codec options * codec state However, it's not clear which ones are which. It is consequently unclear which fields are a demuxer allowed to set or a muxer allowed to read. This leads to erratic behaviour depending on whether decoding or encoding is being performed or not (and whether it uses the AVStream embedded codec context). - various synchronization issues arising from the fact that the same context is used by several different APIs (muxers/demuxers, parsers, bitstream filters and encoders/decoders) simultaneously, with there being no clear rules for who can modify what and the different processes being typically delayed with respect to each other. - avformat_find_stream_info() making it necessary to support opening and closing a single codec context multiple times, thus complicating the semantics of freeing various allocated objects in the codec context. Those problems are resolved by replacing the AVStream embedded codec context with a newly added AVCodecParameters instance, which stores only the stream parameters exported by the demuxers or read by the muxers.
| * mpegtsenc: add flag to embed an AC-3 ES the DVB wayStefan Pöschel2015-12-14
| | | | | | | | | | | | | | | | | | | | | | | | | | So far an AC-3 elementary stream is refered to in the PMT according to System A (ATSC). However System B (DVB) has a different way to signal an AC-3 ES within the PMT. This different way can be enabled by a new flag. The flag is more generally named 'system_b' as there are further differences between ATSC and DVB (e.g. the signalling of E-AC-3) which should then also be covered by it in the future. Bug-Id: 73 Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* | avformat/mpegtsenc: Fix used serviceMichael Niedermayer2016-03-24
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/mpegtsenc: Keep track of the program for each serviceMichael Niedermayer2016-03-24
| | | | | | | | | | | | Simplifies code Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavc/lavf: transmit stream_id information for mpegts KLV data packetsStefano Sabatini2016-02-23
| | | | | | | | | | | | | | | | | | | | | | | | This allows to copy information related to the stream ID from the demuxer to the muxer, thus allowing for example to retain information related to synchronous and asynchronous KLV data packets. This information is used in the muxer when remuxing to distinguish the two kind of packets (if the information is lacking, data packets are considered synchronous). The fate reference changes are due to the use of av_packet_merge_side_data(), which increases the size of the output packet size, since side data is merged into the packet data.
* | mpegtsenc: Do not fail ADTS AAC muxing if the first frame is not ADTSHagen Schmidt2016-01-29
| | | | | | | | | | | | Fixes ticket 279. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/mpegtsenc: Fix multi program so that it supports adding the same ↵Vittorio Gambaletta (VittGam)2016-01-25
| | | | | | | | | | | | | | stream to multiple programs. Signed-off-by: Vittorio Gambaletta <ffmpeg-dev@vittgam.net> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavf/mpegtsenc: add automatic bitstream filteringRodger Combs2015-12-28
| |
* | avformat/mpegtsenc: add flag to embed an AC-3/E-AC-3 ES the DVB wayStefan Pöschel2015-12-24
| | | | | | | | | | | | | | | | | | | | So far an AC-3 elementary stream is refered to in the PMT according to System A (ATSC). An E-AC-3 ES in contrast is embedded the System B (DVB) way. To fix this inconsistency, this commit changes the default E-AC-3 behaviour to use the ATSC way, too. Furthermore a new flag is added to optionally select the DVB way (regarding both codecs and possible further differences in the future). Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/mpegtsenc: Add basic multi program supportMichael Niedermayer2015-12-11
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat: use AV_OPT_TYPE_BOOL in a bunch of placesClément Bœsch2015-12-04
| |