]> git.sesse.net Git - ffmpeg/commit
avformat/mpegtsenc: use total_size instead of avio_tell()
authorLimin Wang <lance.lmwang@gmail.com>
Thu, 22 Oct 2020 01:47:52 +0000 (09:47 +0800)
committerLimin Wang <lance.lmwang@gmail.com>
Tue, 27 Oct 2020 10:18:24 +0000 (18:18 +0800)
commitf3568a33c99aed7326e603b7bff3199bc4686d53
tree15140a3dfa72299dcd413eac6f13e4396a857e4a
parentdf6ec7f83b4fb65d760259e01182dc28b6cf3f2f
avformat/mpegtsenc: use total_size instead of avio_tell()

avio_tell() fails to get the amount of data written so far when the
underlying IO context is flushed to segments.

Please test with below command:
$ ./ffmpeg  -f lavfi -i testsrc=duration=100:size=vga -c:v libx264 -x264opts \
  nal-hrd=cbr:force-cfr=1 -b:v 500k -minrate 500k -maxrate 500k -bufsize 500k \
  -f hls -hls_time 10  -hls_ts_options "muxrate=2000000" test%d.ts

$ du -h test*.ts
Before:
2.4M    test00.ts
4.8M    test11.ts
7.2M    test22.ts
9.6M    test33.ts
12M     test44.ts
...

After apply the patch:
 2.4M   test00.ts
 2.4M   test11.ts
 2.4M   test22.ts
 2.4M   test33.ts
 2.4M   test44.ts
...

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
libavformat/mpegtsenc.c