[Libav-user] encode_video.c example generates malformed video file with libx264

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Libav-user] encode_video.c example generates malformed video file with libx264

Igor Belyakov
I use FFMPEG libraries and headers from here:

https://ffmpeg.zeranoe.com/builds/

Video file generated by this example seems to lack timestamps. It can be fixed with ffmpeg ('ffmpeg.exe -i test.mp4 -c:v copy test_.mp4') which reports the following message:

[mp4 @ 0000021b3b611700] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly

How do I generate a well-formed file with libav?

Complete output of encode_video example:

[libx264 @ 000001a7cfee5a40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 000001a7cfee5a40] profile High, level 1.3, 4:2:0, 8-bit
Send frame   0
Send frame   1
Send frame   2
Send frame   3
Send frame   4
Send frame   5
Send frame   6
Send frame   7
Send frame   8
Send frame   9
Send frame  10
Send frame  11
Send frame  12
Send frame  13
Send frame  14
Send frame  15
Send frame  16
Send frame  17
Send frame  18
Send frame  19
Send frame  20
Send frame  21
Write packet   0 (size= 2055)
Send frame  22
Write packet   2 (size=  672)
Send frame  23
Write packet   1 (size=  133)
Send frame  24
Write packet   4 (size=  766)
Write packet   3 (size=  193)
Write packet   6 (size=  681)
Write packet   5 (size=  515)
Write packet   8 (size=  737)
Write packet   7 (size=  437)
Write packet   9 (size=  506)
Write packet  10 (size= 2240)
Write packet  12 (size= 1011)
Write packet  11 (size=  701)
Write packet  14 (size=  905)
Write packet  13 (size=  495)
Write packet  16 (size=  931)
Write packet  15 (size=  639)
Write packet  18 (size= 1267)
Write packet  17 (size=  575)
Write packet  19 (size=  611)
Write packet  20 (size= 2361)
Write packet  22 (size= 1122)
Write packet  21 (size=  747)
Write packet  24 (size=  718)
Write packet  23 (size=  703)
[libx264 @ 000001a7cfee5a40] frame I:3     Avg QP:25.32  size:  2219
[libx264 @ 000001a7cfee5a40] frame P:12    Avg QP:24.19  size:   827
[libx264 @ 000001a7cfee5a40] frame B:10    Avg QP:28.20  size:   514
[libx264 @ 000001a7cfee5a40] consecutive B-frames: 20.0% 80.0%
[libx264 @ 000001a7cfee5a40] mb I  I16..4: 78.4% 11.4% 10.2%
[libx264 @ 000001a7cfee5a40] mb P  I16..4: 76.7%  0.9%  0.2%  P16..4: 20.9%  0.7%  0.3%  0.0%  0.0%    skip: 0.3%
[libx264 @ 000001a7cfee5a40] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 11.7%  0.3%  0.0%  direct:11.1%  skip:77.0%  L0:25.0% L1:39.1% BI:35.9%
[libx264 @ 000001a7cfee5a40] final ratefactor: 15.76
[libx264 @ 000001a7cfee5a40] 8x8 transform intra:3.6% inter:19.2%
[libx264 @ 000001a7cfee5a40] direct mvs  spatial:0.0% temporal:100.0%
[libx264 @ 000001a7cfee5a40] coded y,uvDC,uvAC intra: 4.8% 31.7% 4.2% inter: 1.3% 35.7% 8.8%
[libx264 @ 000001a7cfee5a40] i16 v,h,dc,p:  0%  0%  0% 100%
[libx264 @ 000001a7cfee5a40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  3% 32% 16% 48%  0%  0%  0%  0%  0%
[libx264 @ 000001a7cfee5a40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10%  7% 14% 53%  1%  5%  2%  7%  1%
[libx264 @ 000001a7cfee5a40] i8c dc,h,v,p:  1%  6%  4% 88%
[libx264 @ 000001a7cfee5a40] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000001a7cfee5a40] ref P L0: 97.3%  0.7%  1.5%  0.3%  0.1%  0.1%
[libx264 @ 000001a7cfee5a40] ref B L0: 64.1% 33.4%  2.4%
[libx264 @ 000001a7cfee5a40] kb/s:173.77



Complete output of ffmpeg copy:

ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9.2.1 (GCC) 20200122
  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, h264, from 'test.mp4':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p(progressive), 352x288, 25 fps, 25 tbr, 1200k tbn, 50 tbc
Output #0, mp4, to 'test_.mp4':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 352x288, q=2-31, 25 fps, 25 tbr, 1200k tbn, 1200k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mp4 @ 000001c620775380] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[mp4 @ 000001c620775380] pts has no value
    Last message repeated 24 times
frame=   25 fps=0.0 q=-1.0 Lsize=      22kB time=00:00:00.92 bitrate= 197.0kbits/s speed=24.4x
video:21kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 4.276967%


_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".