[FFmpeg-devel] [PATCH] libavformat: fix copyts and muxrate in mpegts muxer
Andreas Håkon
andreas.hakon at protonmail.com
Thu Apr 18 12:01:42 EEST 2019
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.
---
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-libavformat-fix-copyts-with-muxrate.patch.txt
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190418/9837f480/attachment.txt>
More information about the ffmpeg-devel
mailing list