I'm trying to find the number of reference frames used by a video using the 
avcodec/format API. From the API description it seems that all I have to do is 
to use:

AVCodecContext::refs

... but that value is always at 1. I know for sure (both since I encoded the 
file and for the mediainfo output) that the ref frames of my sample video files 
are different.

I'm quite sure it's a bug of ffmpeg since also if I check the reference frame 
number using ffmpeg/ffprobe (master, compiled 10 minutes before writing this 
post) it returns 1 for the given video file (that should have 5).

Further digging in the net about this problem I found also a ticket about this:

https://trac.ffmpeg.org/ticket/6001
#6001 (ffprobe: incorrect determination of the number of reference frames) – 
FFmpeg<https://trac.ffmpeg.org/ticket/6001>
Hi! ffprobe incorrect determinates of the number of reference frames. ffprobe 
for all video returns refs=1, which does not coincide with the values returned 
by MediaInfo?. The attached txt file contains information returned by ffprobe 
and MediaInfo?.
trac.ffmpeg.org
... that is opened since 5 years 🙁

If someone wants to take a look at this problem, here is the test file I used

http://cdn5.wyscout.com/get/video.mp4

Here is the mediainfo report of that file:

iMac-2 $ mediainfo ~/Desktop/video.mp4
General
Complete name                            : video.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 8.30 MiB
Duration                                 : 29 s 143 ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 2 388 kb/s
Performer                                : Q2xpcHBlciAzODQgKGlwLTEwLTUtMy04NCk=}
Writing application                      : Lavf58.20.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : [email protected]
Format settings                          : 5 Ref Frames
Format settings, CABAC                   : No
Format settings, Reference frames        : 5 frames
Format settings, GOP                     : M=1, N=25
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 29 s 120 ms
Bit rate                                 : 2 200 kb/s
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
[...]




... and here is what ffmpeg/ffprobe says of the file (master, but also 4.2.x 
has the same results) :

iMac-2 $ ./ffmpeg -loglevel verbose -i ~/Desktop/video.mp4
ffmpeg version N-101901-gb593abda6c Copyright (c) 2000-2021 the FFmpeg 
developers
  built with Apple clang version 12.0.0 (clang-1200.0.32.29)
  configuration: --disable-lzma --prefix=/usr/local/sdk/darwin-x64 
--enable-libx264 --enable-libfdk-aac --enable-nonfree --enable-gpl 
--enable-libopus --enable-libvpx --enable-libvorbis --enable-pic --disable-sdl2
  libavutil      56. 72.100 / 56. 72.100
  libavcodec     58.135.100 / 58.135.100
  libavformat    58. 78.100 / 58. 78.100
  libavdevice    58. 14.100 / 58. 14.100
  libavfilter     7.111.100 /  7.111.100
  libswscale      5. 10.100 /  5. 10.100
  libswresample   3. 10.100 /  3. 10.100
  libpostproc    55. 10.100 / 55. 10.100
[h264 @ 0x7faec700b000] Reinit context to 1280x720, pix_fmt: yuv420p
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/gabry/Desktop/video.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    artist          : Q2xpcHBlciAzODQgKGlwLTEwLTUtMy04NCk=}
    encoder         : Lavf58.20.100
  Duration: 00:00:29.14, start: 0.000000, bitrate: 2388 kb/s
  Stream #0:0(und): Video: h264 (Constrained Baseline), 1 reference frame (avc1 
/ 0x31637661), yuv420p(left), 1280x720 [SAR 1:1 DAR 16:9], 2296 kb/s, 25 fps, 
25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, 
fltp, 87 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]





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

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

Reply via email to