[FFmpeg-devel] [PATCH] libavformat: fix copyts and muxrate in mpegts muxer

Andreas Håkon andreas.hakon at protonmail.com
Fri Apr 19 11:47:34 EEST 2019

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Thursday, 18 de April de 2019 11:01, Andreas Håkon via ffmpeg-devel <ffmpeg-devel at ffmpeg.org> wrote:

> Hi,
> This patch resolves one very specific use case:
> -   When you use the mpegts muxer;
> -   And use the global parameter “-copyts”;
> -   And use the parameter “-muxrate” for the mpegts muxer;
> -   And use too the parameter “-mpegts_copyts”.
>     The problem is created because the member “first_pcr” of the MpegTSWrite struct isn’t initialized with a correct timestamp (so when copying the timestamps the initial value is 0). And in this case an infinite loop is created because the code never writes PES packets when the “mux_rate” isn’t VBR (equals to 1). See the block that creates the loop here (note the "continue" command at end):
>     https://github.com/FFmpeg/FFmpeg/blob/a0559fcd81f42f446c93357a943699f9d44eeb79/libavformat/mpegtsenc.c#L1211
>     So, this patch fixes the problem initializing the “first_pcr” with the first DTS value that comes when using the incoming timestamps.
>     Regards.
>     A.H.


Here a new version of the patch.

The "fist_pcr" value is now derived from DTS in a more consistent way.



-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-libavformat-fix-copyts-and-muxrate-in-mpegts-muxer-2.patch.txt
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190419/e82fd126/attachment.txt>

More information about the ffmpeg-devel mailing list