You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avformat/mpegtsenc: fix first_pcr initial update
Commit 6f36eb0da7
claim it fixes endless loop on
package generation if muxrate specified and copyts used. But actually it does
not work properly if -mpegts_copyts 1 is specified:
ffmpeg -y -copyts -i loewe.ts -c:v libx264 -x264opts nal-hrd=cbr:force-cfr=1 -b:v 3500k -minrate 3500k -maxrate 3500k -bufsize 1000k -c:a mp2 -f mpegts -mpegts_copyts 1 -muxrate 4500k -vframes 1000 test.ts
ffmpeg generate huge file until it reach zero-based pcr value equal to first dts.
Attached patch fixes it.
Reviewed-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
committed by
Marton Balint
parent
9d4989f2e1
commit
a085418303
@@ -1852,12 +1852,12 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
|
|||||||
if (side_data)
|
if (side_data)
|
||||||
stream_id = side_data[0];
|
stream_id = side_data[0];
|
||||||
|
|
||||||
if (ts->copyts < 1) {
|
if (!ts->first_dts_checked && dts != AV_NOPTS_VALUE) {
|
||||||
if (!ts->first_dts_checked && dts != AV_NOPTS_VALUE) {
|
ts->first_pcr += dts * 300;
|
||||||
ts->first_pcr += dts * 300;
|
ts->first_dts_checked = 1;
|
||||||
ts->first_dts_checked = 1;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
if (ts->copyts < 1) {
|
||||||
if (pts != AV_NOPTS_VALUE)
|
if (pts != AV_NOPTS_VALUE)
|
||||||
pts += delay;
|
pts += delay;
|
||||||
if (dts != AV_NOPTS_VALUE)
|
if (dts != AV_NOPTS_VALUE)
|
||||||
|
Reference in New Issue
Block a user