Opened 5 years ago

Closed 5 years ago

#384 closed defect (invalid)

Incorrect number of frames reported with .3gp file

Reported by: hackish Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: frame count
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

This problem was originally encountered debugging an openCV problem. ffmpeg reports an incorrect number of frames with .3gp files. I have verified this with 2 different sources.

GSpot reports 684 frames with the attached file and I have verified this by decoding and counting all the frames. ffmpeg however reports 813 frames. In another test I had a file with 10650 frames but ffmpeg reported 21309 frames. (file is 50mb so not included).

Attachments (1)

VID 00004-20100701-2206.3GP (1.7 MB) - added by hackish 5 years ago.

Download all attachments as: .zip

Change History (7)

Changed 5 years ago by hackish

comment:1 Changed 5 years ago by hackish

Output that shows the frame count...

D:\>"c:\Program Files (x86)\ffmpeg\bin\ffmpeg" -i "VID 00004-20100701-2206.3GP" -f null /dev/null
ffmpeg version N-31774-g6c4e9ca, Copyright (c) 2000-2011 the FFmpeg developers

built on Aug 6 2011 22:22:11 with gcc 4.6.1
configuration: --enable-gpl --enable-version3 --enable-memalign-hack --enable-runtime-cpudetect --enable-avisynth --enable-bzlib -

-enable-frei0r --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enab
le-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --e
nable-libx264 --enable-libxavs --enable-libxvid --enable-zlib

libavutil 51. 11. 1 / 51. 11. 1
libavcodec 53. 9. 1 / 53. 9. 1
libavformat 53. 6. 0 / 53. 6. 0
libavdevice 53. 2. 0 / 53. 2. 0
libavfilter 2. 28. 0 / 2. 28. 0
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'VID 00004-20100701-2206.3GP':

Metadata:

major_brand : isom
minor_version : 0
compatible_brands: mp41isom
creation_time : 2010-07-02 02:07:25

Duration: 00:00:27.26, start: 0.000000, bitrate: 532 kb/s

Stream #0.0(eng): Video: mpeg4 (Simple Profile), yuv420p, 480x352 [SAR 1:1 DAR 15:11], 505 kb/s, 25.21 fps, 30 tbr, 30 tbn, 30 t

bc

Metadata:

creation_time : 2010-07-02 02:07:25

Stream #0.1(eng): Audio: aac, 16000 Hz, mono, s16, 27 kb/s
Metadata:

creation_time : 2010-07-02 02:07:25

[buffer @ 031A08C0] w:480 h:352 pixfmt:yuv420p tb:1/1000000 sar:1/1 sws_param:
Output #0, null, to '/dev/null':

Metadata:

major_brand : isom
minor_version : 0
compatible_brands: mp41isom
creation_time : 2010-07-02 02:07:25
encoder : Lavf53.6.0
Stream #0.0(eng): Video: rawvideo, yuv420p, 480x352 [SAR 1:1 DAR 15:11], q=2-31, 200 kb/s, 90k tbn, 30 tbc
Metadata:

creation_time : 2010-07-02 02:07:25

Stream #0.1(eng): Audio: pcm_s16le, 16000 Hz, mono, s16, 256 kb/s
Metadata:

creation_time : 2010-07-02 02:07:25

Stream mapping:

Stream #0.0 -> #0.0
Stream #0.1 -> #0.1

Press [q] to stop, ? for help
frame= 813 fps= 0 q=0.0 Lsize= -0kB time=00:00:27.10 bitrate= -0.0kbits/s dup=129 drop=0
video:0kB audio:852kB global headers:0kB muxing overhead -100.002522%

comment:2 Changed 5 years ago by cehoyos

  • Status changed from new to open

ffmpeg also reports 684 frames (either use -vsync 0 or subtract the duplicated frames - 129 - from the number of output frames).

Could you explain what your problem is? I don't think ffmpeg is designed to count frames (although it does work fine for the file you uploaded), maybe it works with ffprobe, I haven't used it much.

For this sample, the frame duplication does not happen for every container (avi), for your other sample, fps is probably misdetected.

comment:3 Changed 5 years ago by hackish

Ok, this might not be an ffmpeg problem. OpenCV uses ffmpeg to get the frame count from a file so it might be its use of ffmpeg that is incorrect. I have not figured out a way to get ffprobe to give me the frame count but adding the vsync 0 to ffprobe appears to work. Can you let me know how to determine how many duplicates there are within ffmpeg?

comment:4 Changed 5 years ago by cehoyos

Are you sure counting frames is what you really want to do?
(I ask because I suspect this is not your actual problem, which I still don't understand.)

You find the number of duplicated frames in a stream in FFmpeg's output, the second to last line (see your original post, search for "129").

comment:5 Changed 5 years ago by hackish

Ok, I think I can use that to search the source and see how ffmpeg is determining this. I assume it can be found without decoding the entire video? I'm also taking it up with the opencv people and may submit a patch once I determine how to get the frame count.

comment:6 Changed 5 years ago by cehoyos

  • Resolution set to invalid
  • Status changed from open to closed

As said, I do not believe ffmpeg is designed to count frames, but unfortunately I do not understand your use-case.

Note: See TracTickets for help on using tickets.