Opened 5 years ago

Closed 5 years ago

#3678 closed defect (fixed)

Regressions in the video duration/bitrate report

Reported by: Malizor Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: mpeg2video regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

We noticed that, from version n1.1 and on, ffprobe reports wrong video duration/bitrate
for a video file (MXF format).

How to reproduce:

% ffprobe Sample.mxf

tested only on Linux, both 32 and 64bits.
Interestingly, note that it works on the standard avconv of Ubuntu 14.04 (9.13-6:9.13-0ubuntu0.14.04.1). We did not test with others avconv versions.

I attached a small sample from the beginning of our video. The console output of
the git HEAD, n1.1, and n1.0 (which is the last version tested without a problem) is given
below:

HEAD (commit 58632070866a529913355df1d9c7cc71fa91ffde)

ffprobe version N-63469-g5863207 Copyright (c) 2007-2014 the FFmpeg developers
  built on May 27 2014 16:20:47 with gcc 4.8 (Ubuntu/Linaro 4.8.1-10ubuntu9)
  configuration: 
  libavutil      52. 87.100 / 52. 87.100
  libavcodec     55. 65.100 / 55. 65.100
  libavformat    55. 41.100 / 55. 41.100
  libavdevice    55. 13.101 / 55. 13.101
  libavfilter     4.  5.100 /  4.  5.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
[mxf @ 0x2252020] Estimating duration from bitrate, this may be inaccurate
Input #0, mxf, from 'Sample.mxf':
  Metadata:
    uid             : 98a72bb5-4bba-e111-92d9-00d0280f7410
    generation_uid  : aca72bb5-4bba-e111-bc13-00d0280f7410
    company_name    : Omneon Inc.
    product_name    : Omneon Media Subsystem
    modification_date: 2012-06-19 20:16:52
    product_version : 6.3.1.0.release
    application_platform: Omneon Media Api (mqx)    
    product_uid     : 00000000-0000-0010-8000-050e0b010602
    timecode        : 10:00:00:01
  Duration: 00:00:00.92, start: 0.000000, bitrate: 9118 kb/s
    Stream #0:0: Video: mpeg2video (4:2:2), yuv422p(tv), 720x608 [SAR 152:135 DAR 4:3], max. 50000 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
    Stream #0:1: Audio: pcm_s24le, 48000 Hz, 8 channels, s32, 9216 kb/s

n1.1

ffprobe version 1.1 Copyright (c) 2007-2013 the FFmpeg developers
  built on May 27 2014 16:51:17 with gcc 4.8 (Ubuntu/Linaro 4.8.1-10ubuntu9)
  configuration: 
  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 86.100 / 54. 86.100
  libavformat    54. 59.106 / 54. 59.106
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 32.100 /  3. 32.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
Truncating packet of size 250000 to 102381
[mxf @ 0x1711c60] Estimating duration from bitrate, this may be inaccurate
Input #0, mxf, from 'Sample.mxf':
  Metadata:
    timecode        : 10:00:00:01
  Duration: 00:00:00.92, start: 0.000000, bitrate: 9118 kb/s
    Stream #0:0: Video: mpeg2video (4:2:2), yuv422p, 720x608 [SAR 152:135 DAR 4:3], 25 fps, 25 tbr, 25 tbn, 50 tbc
    Stream #0:1: Audio: pcm_s24le, 48000 Hz, 8 channels, s32, 9216 kb/s

n1.0

ffprobe version 1.0 Copyright (c) 2007-2012 the FFmpeg developers
  built on May 27 2014 16:46:03 with gcc 4.8 (Ubuntu/Linaro 4.8.1-10ubuntu9)
  configuration: 
  libavutil      51. 73.101 / 51. 73.101
  libavcodec     54. 59.100 / 54. 59.100
  libavformat    54. 29.104 / 54. 29.104
  libavdevice    54.  2.101 / 54.  2.101
  libavfilter     3. 17.100 /  3. 17.100
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
Truncating packet of size 250000 to 102381
[mxf @ 0x208f3e0] Estimating duration from bitrate, this may be inaccurate
Input #0, mxf, from 'Sample.mxf':
  Metadata:
    timecode        : 10:00:00:01
  Duration: 00:00:00.16, start: 0.000000, bitrate: 52428 kb/s
    Stream #0:0: Video: mpeg2video (4:2:2), yuv422p, 720x608 [SAR 152:135 DAR 4:3], 50000 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
    Stream #0:1: Audio: pcm_s24le, 48000 Hz, 8 channels, s32, 9216 kb/s

Attachments (4)

Sample.mxf (1.0 MB) - added by Malizor 5 years ago.
Sample file to reproduce the problem
n1.0.log (13.0 KB) - added by Malizor 5 years ago.
Full console output of n1.0 with -v 9 -loglevel 99
n1.1.log (13.0 KB) - added by Malizor 5 years ago.
Full console output of n1.1 with -v 9 -loglevel 99
HEAD.log (13.5 KB) - added by Malizor 5 years ago.
Full console output of git HEAD with -v 9 -loglevel 99

Download all attachments as: .zip

Change History (15)

Changed 5 years ago by Malizor

Sample file to reproduce the problem

Changed 5 years ago by Malizor

Full console output of n1.0 with -v 9 -loglevel 99

Changed 5 years ago by Malizor

Full console output of n1.1 with -v 9 -loglevel 99

Changed 5 years ago by Malizor

Full console output of git HEAD with -v 9 -loglevel 99

comment:1 in reply to: ↑ description ; follow-up: Changed 5 years ago by cehoyos

  • Component changed from ffmpeg to avcodec

Replying to Malizor:

Duration: 00:00:00.16, start: 0.000000, bitrate: 52428 kb/s

Do you believe that this value is correct?

Stream #0:0: Video: mpeg2video (4:2:2), yuv422p, 720x608 [SAR 152:135 DAR 4:3], 50000 kb/s

Showing a bitrate for a mpegvideo stream was assumed to be wrong (there is no bitrate written in the stream), this is why max. 50000 kb/s is shown now. Do you have any indication that the change was wrong?

comment:2 in reply to: ↑ 1 ; follow-up: Changed 5 years ago by Malizor

Replying to cehoyos:

Replying to Malizor:

Duration: 00:00:00.16, start: 0.000000, bitrate: 52428 kb/s

Do you believe that this value is correct?

Yes.

Stream #0:0: Video: mpeg2video (4:2:2), yuv422p, 720x608 [SAR 152:135 DAR 4:3], 50000 kb/s

Showing a bitrate for a mpegvideo stream was assumed to be wrong (there is no bitrate written in the stream), this is why max. 50000 kb/s is shown now. Do you have any indication that the change was wrong?

The full video file is 40G and is 1h 26mn long. New versions of ffmpeg detect it as being 9h 48m long with the very low bitrate that can still be seen with the attached sample.

I understand what you say about the bitrate, but it's sure that it is truly higher than the detected 9118 kb/s.

Also, as an additional test, I noticed that mediainfo also return the right metadata.

comment:3 in reply to: ↑ 2 ; follow-up: Changed 5 years ago by cehoyos

Replying to Malizor:

Replying to cehoyos:

Replying to Malizor:

Duration: 00:00:00.16, start: 0.000000, bitrate: 52428 kb/s

Do you believe that this value is correct?

Yes.

The full video file is 40G and is 1h 26mn long.

Does this really imply ~50Mb/s? Doesn't sound correct to me.
How does old ffmpeg -i look for your complete 40G sample?

New versions of ffmpeg detect it as being 9h 48m long

And a warning is shown that this value is maybe incorrect.

I understand what you say about the bitrate, but it's sure that it is truly higher than the detected 9118 kb/s.

Of course.
The bitrate of the file is unknown / wrong because the video stream doesn't store a bitrate.

comment:4 in reply to: ↑ 3 ; follow-up: Changed 5 years ago by Malizor

Replying to cehoyos:

Replying to Malizor:

The full video file is 40G and is 1h 26mn long.

Sorry, in fact it is truly 1:48:31 long (as verified by playing the video in VLC 2.0.8)

Does this really imply ~50Mb/s? Doesn't sound correct to me.
How does old ffmpeg -i look for your complete 40G sample?

0.10.10 (good estimation):

ffmpeg -i ~/file_1_VR_16_PCBD_1.mxf 
ffmpeg version 0.10.10 Copyright (c) 2000-2013 the FFmpeg developers
  built on May 28 2014 11:23:04 with gcc 4.8.1
  configuration: 
  libavutil      51. 35.100 / 51. 35.100
  libavcodec     53. 61.100 / 53. 61.100
  libavformat    53. 32.100 / 53. 32.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 61.100 /  2. 61.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  6.100 /  0.  6.100
[mxf @ 0x29843a0] Estimating duration from bitrate, this may be inaccurate
Input #0, mxf, from '/home/malizor/file_1_VR_16_PCBD_1.mxf':
  Duration: 01:48:31.68, start: 0.000000, bitrate: 49999 kb/s
    Stream #0:0: Video: mpeg2video (4:2:2), yuv422p, 720x608 [SAR 152:135 DAR 4:3], 50000 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
    Stream #0:1: Audio: pcm_s24le, 48000 Hz, 8 channels, s32, 9216 kb/s
At least one output file must be specified

1.0 (estimation a bit too short):

ffmpeg -i ~/file_1_VR_16_PCBD_1.mxf 
ffmpeg version 1.0 Copyright (c) 2000-2012 the FFmpeg developers
  built on May 27 2014 17:07:38 with gcc 4.8 (Ubuntu/Linaro 4.8.1-10ubuntu9)
  configuration: 
  libavutil      51. 73.101 / 51. 73.101
  libavcodec     54. 59.100 / 54. 59.100
  libavformat    54. 29.104 / 54. 29.104
  libavdevice    54.  2.101 / 54.  2.101
  libavfilter     3. 17.100 /  3. 17.100
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
[mxf @ 0x1d50240] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for  Input Stream #0.1 : 7.1
Input #0, mxf, from '/home/malizor/file_1_VR_16_PCBD_1.mxf':
  Metadata:
    timecode        : 10:00:00:01
  Duration: 01:31:38.24, start: 0.000000, bitrate: 59215 kb/s
    Stream #0:0: Video: mpeg2video (4:2:2), yuv422p, 720x608 [SAR 152:135 DAR 4:3], 50000 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
    Stream #0:1: Audio: pcm_s24le, 48000 Hz, 7.1, s32, 9216 kb/s
At least one output file must be specified

HEAD (estimation way too big):

ffmpeg -i ~/file_1_VR_16_PCBD_1.mxf 
ffmpeg version N-63469-g5863207 Copyright (c) 2000-2014 the FFmpeg developers
  built on May 27 2014 16:20:47 with gcc 4.8 (Ubuntu/Linaro 4.8.1-10ubuntu9)
  configuration: 
  libavutil      52. 87.100 / 52. 87.100
  libavcodec     55. 65.100 / 55. 65.100
  libavformat    55. 41.100 / 55. 41.100
  libavdevice    55. 13.101 / 55. 13.101
  libavfilter     4.  5.100 /  4.  5.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
[mxf @ 0x3156ae0] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for  Input Stream #0.1 : 7.1
Input #0, mxf, from '/home/malizor/file_1_VR_16_PCBD_1.mxf':
  Metadata:
    application_platform: Omneon Media Api (mqx)    
    uid             : 98a72bb5-4bba-e111-92d9-00d0280f7410
    generation_uid  : aca72bb5-4bba-e111-bc13-00d0280f7410
    company_name    : Omneon Inc.
    product_name    : Omneon Media Subsystem
    modification_date: 2012-06-19 20:16:52
    product_version : 6.3.1.0.release
    product_uid     : 00000000-0000-0010-8000-050e0b010602
    timecode        : 10:00:00:01
  Duration: 09:48:48.04, start: 0.000000, bitrate: 9215 kb/s
    Stream #0:0: Video: mpeg2video (4:2:2), yuv422p(tv), 720x608 [SAR 152:135 DAR 4:3], max. 50000 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
    Stream #0:1: Audio: pcm_s24le, 48000 Hz, 7.1, s32, 9216 kb/s
At least one output file must be specified

New versions of ffmpeg detect it as being 9h 48m long

And a warning is shown that this value is maybe incorrect.

Indeed.
So the problem is that the estimation was better in older versions.

I understand what you say about the bitrate, but it's sure that it is truly higher than the detected 9118 kb/s.

Of course.
The bitrate of the file is unknown / wrong because the video stream doesn't store a bitrate.

Apparently somthing changed in the way ffmpeg try to guess the bitrate, and it has regressed for some videos like this one.

Last edited 5 years ago by Malizor (previous) (diff)

comment:5 in reply to: ↑ 4 ; follow-up: Changed 5 years ago by cehoyos

Replying to Malizor:

Replying to cehoyos:

Replying to Malizor:

The full video file is 40G and is 1h 26mn long.

Sorry, in fact it is truly 1:48:31 long (as verified by playing the video in VLC 2.0.8)

Could you add the exact file size?
ffmpeg -i input -f null - tells you the exact length.

I understand what you say about the bitrate, but it's sure that it is truly higher than the detected 9118 kb/s.

Of course.
The bitrate of the file is unknown / wrong because the video stream doesn't store a bitrate.

Apparently somthing changed in the way ffmpeg try to guess the bitrate, and it has regressed for some videos like this one.

No. (Or at least I find this wording misleading.)
The value written in mpegvideo streams is not the actual bitrate but the maximum bitrate.
For your (mxf) file, the values are nearly identical, for (more typical) dvb streams, the value is completely wrong. It was therefore decided not to use the (possibly wrong) maximum bitrate value as actual video bitrate.

comment:6 in reply to: ↑ 5 Changed 5 years ago by Malizor

Replying to cehoyos:

Replying to Malizor:

Replying to cehoyos:

Replying to Malizor:

The full video file is 40G and is 1h 26mn long.

Sorry, in fact it is truly 1:48:31 long (as verified by playing the video in VLC 2.0.8)

Could you add the exact file size?
ffmpeg -i input -f null - tells you the exact length.

I get this: frame=130095 fps=221 q=0.0 Lsize=N/A time=01:26:43.80 bitrate=N/A

Why is it not the same as what I get by playing the file in VLC? (I can seek to the very end of the video... Could it be framerate related?)

comment:7 follow-up: Changed 5 years ago by cehoyos

Could you add the exact file size?

comment:8 in reply to: ↑ 7 Changed 5 years ago by Malizor

Replying to cehoyos:

Could you add the exact file size?

40697893424 bytes (according to ls -l)

comment:9 Changed 5 years ago by cehoyos

  • Keywords mpegvideo regression added

I am not sure if this can be fixed.

comment:10 Changed 5 years ago by cehoyos

  • Keywords mpeg2video added; mpegvideo removed

comment:11 Changed 5 years ago by michael

  • Reproduced by developer set
  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.