Opened 3 years ago

Closed 3 years ago

#2211 closed defect (fixed)

Not possible to override bogus FPS in raw h264 streams

Reported by: jaanusk Owned by:
Priority: important Component: ffmpeg
Version: git-master Keywords: h264 regression
Cc: zagser168@yandex.ru Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

It's not possible to override fps on raw h264 streams.

For example, I have a stream produced by Raspberry PI HW encoder which plays fine when fps
is forced. The actual fps is 15, but recent ffmpeg versions default somehow to 25fps.

How to reproduce:

% ffmpeg -r 15 -i stream_00 -vcodec copy stream.mp4
ffmpeg version N-49440-gebe368d Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan 29 2013 16:08:08 with gcc 4.7 (Debian 4.7.2-5)
  configuration: 
  libavutil      52. 17.100 / 52. 17.100
  libavcodec     54. 91.100 / 54. 91.100
  libavformat    54. 61.104 / 54. 61.104
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 34.101 /  3. 34.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
[h264 @ 0x1bcf000] max_analyze_duration 5000000 reached at 5000000 microseconds
[h264 @ 0x1bcf000] Estimating duration from bitrate, this may be inaccurate
Input #0, h264, from 'stream_00':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p, 960x720, 25 fps, 25 tbr, 1200k tbn, 50 tbc
Output #0, mp4, to 'stream.mp4':
  Metadata:
    encoder         : Lavf54.61.104
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 960x720, q=2-31, 25 fps, 1200k tbn, 1200k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=224753 fps=173017 q=-1.0 Lsize=  103295kB time=02:29:50.08 bitrate=  94.1kbits/s    
video:102400kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.873958%

Output file plays faster then normal because the actual source is 15fps and ffmpeg does not allow to override this.

Last version that works as expected is 0.11.2.

Attachments (1)

sample.h264 (200.0 KB) - added by jaanusk 3 years ago.
Raw h264 file from Raspberry Pi encoder, 15fps

Download all attachments as: .zip

Change History (12)

comment:1 in reply to: ↑ description Changed 3 years ago by cehoyos

  • Keywords h264 added

Replying to jaanusk:

Last version that works as expected is 0.11.2.

This is unexpected: Please provide command line including complete, uncut console output for a working revision and provide an input sample.

comment:2 Changed 3 years ago by jaanusk

Working example:

$ ffmpeg -r 15 -i sample.h264 -vcodec copy out.mp4
ffmpeg version 0.11.2 Copyright (c) 2000-2012 the FFmpeg developers
  built on Jan 23 2013 11:04:28 with gcc 4.4.5
  configuration: 
  libavutil      51. 54.100 / 51. 54.100
  libavcodec     54. 23.100 / 54. 23.100
  libavformat    54.  6.100 / 54.  6.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     2. 77.100 /  2. 77.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
[h264 @ 0x1e459160] max_analyze_duration 5000000 reached at 5000000
[h264 @ 0x1e459160] Estimating duration from bitrate, this may be inaccurate                                                              
Input #0, h264, from 'sample.h264':                                                                                                       
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p, 960x720, 15 fps, 15 tbr, 1200k tbn, 30 tbc
Output #0, mp4, to 'out.mp4':
  Metadata:
    encoder         : Lavf54.6.100
    Stream #0:0: Video: h264 (![0][0][0] / 0x0021), yuv420p, 960x720, q=2-31, 15 fps, 1200k tbn, 1200k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=  140 fps=0.0 q=-1.0 Lsize=     202kB time=00:00:09.26 bitrate= 178.8kbits/s    
video:200kB audio:0kB global headers:0kB muxing overhead 1.108398%

Changed 3 years ago by jaanusk

Raw h264 file from Raspberry Pi encoder, 15fps

comment:3 Changed 3 years ago by cehoyos

Ticket #2276 is probably a duplicate of this ticket.

comment:4 Changed 3 years ago by michael

  • Reproduced by developer set
  • Resolution set to fixed
  • Status changed from new to closed
Version 0, edited 3 years ago by michael (next)

comment:5 Changed 3 years ago by jaanusk

  • Resolution fixed deleted
  • Status changed from closed to reopened

Broken in 1.2.3 and 2.0.1:

$ ffmpeg -r 15 -i sample.h264 -vcodec copy out.mp4
ffmpeg version 2.0.1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Sep 26 2013 12:24:48 with gcc 4.4.5 (Debian 4.4.5-8)
  configuration: --enable-libx264 --enable-gpl
  libavutil      52. 38.100 / 52. 38.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.100 / 55. 12.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 79.101 /  3. 79.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Input #0, h264, from 'sample.h264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p, 960x720, 25 fps, 25 tbr, 1200k tbn, 50 tbc
Output #0, mp4, to 'out.mp4':
  Metadata:
    encoder         : Lavf55.12.100
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 960x720, q=2-31, 25 fps, 15360 tbn, 15 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=  140 fps=0.0 q=-1.0 Lsize=     201kB time=00:00:09.33 bitrate= 176.7kbits/s    
video:200kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.675293% 
Last edited 3 years ago by jaanusk (previous) (diff)

comment:6 Changed 3 years ago by cehoyos

Please test current git head.

comment:7 Changed 3 years ago by jaanusk

git head also broken:

$ /usr/local/bin/ffmpeg -r 15 -i sample.h264 -vcodec copy out.mp4
ffmpeg version N-56677-g689a1bd Copyright (c) 2000-2013 the FFmpeg developers
  built on Sep 27 2013 07:16:18 with gcc 4.8.1 (GCC) 20130603 (Red Hat 4.8.1-1)
  configuration: --enable-libx264 --enable-gpl
  libavutil      52. 46.100 / 52. 46.100
  libavcodec     55. 33.100 / 55. 33.100
  libavformat    55. 18.103 / 55. 18.103
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 87.100 /  3. 87.100
  libswscale      2.  5.100 /  2.  5.100
  libswresample   0. 17.103 /  0. 17.103
  libpostproc    52.  3.100 / 52.  3.100
Input #0, h264, from 'sample.h264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p, 960x720, 25 fps, 25 tbr, 1200k tbn, 50 tbc
Output #0, mp4, to 'out.mp4':
  Metadata:
    encoder         : Lavf55.18.103
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 960x720, q=2-31, 25 fps, 15360 tbn, 15 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=  140 fps=0.0 q=-1.0 Lsize=     201kB time=00:00:09.33 bitrate= 176.7kbits/s    
video:200kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.675293%

comment:8 follow-up: Changed 3 years ago by cehoyos

I tested your sample and command line the other day and it appeared to me that out.mp4 is created with the the intended 15fps. Which application do you use for testing / how does ffplay play the output file for you?

comment:9 in reply to: ↑ 8 Changed 3 years ago by jaanusk

Replying to cehoyos:

I tested your sample and command line the other day and it appeared to me that out.mp4 is created with the the intended 15fps. Which application do you use for testing / how does ffplay play the output file for you?

Indeed, mplayer shows the actual produced file to be 15fps.

Text output is still misleading "25 fps" though.

comment:10 Changed 3 years ago by zagser168

  • Cc zagser168@yandex.ru added

comment:11 Changed 3 years ago by cehoyos

  • Component changed from undetermined to FFmpeg
  • Keywords regression added
  • Priority changed from normal to important
  • Resolution set to fixed
  • Status changed from reopened to closed

Afaict, this was a regression which was fixed by Michael. If you believe that the console output is misleading, please open a new ticket.

Note: See TracTickets for help on using tickets.