[FFmpeg-user] Valid H264 stream wrapped in MP4 cannot be converted back to a valid H264 stream

mvram ram at modernvideo.co
Fri Sep 14 19:50:41 CEST 2012


Hi, I need to extract compressed H264 streams from MP4 files and pass it on
to another application. However, when I extract H264 stream from a Mp4 file,
I found this oddity. 

I generated my test MP4 with a valid H264 stream in it. I am able to play
the MP4 file using VLC. Then when I extracted H264 from the same MP4 file,
even FFmpeg couldn't recognize that output as a valid video stream. 

Am I missing some parameters? Please advise.


$ ./ffmpeg -i ~/pix/Aspen1Mbps.264

ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
  built on Sep 14 2012 10:39:41 with llvm_gcc 4.2.1 (Based on Apple Inc.
build 5658) (LLVM build 2336.9.00)
  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 @ 0x7f9b6201ae00] Estimating duration from bitrate, this may be
inaccurate
Input #0, h264, from '/Users/mvram/pix/Aspen1Mbps.264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuv420p, 640x480, 25 fps, 25 tbr, 1200k
tbn, 50 tbc
At least one output file must be specified


$ ./ffmpeg -i ~/pix/Aspen1Mbps.264 -vcodec copy -an -y /tmp/F1.mp4

ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
  built on Sep 14 2012 10:39:41 with llvm_gcc 4.2.1 (Based on Apple Inc.
build 5658) (LLVM build 2336.9.00)
  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 @ 0x7f879981ae00] Estimating duration from bitrate, this may be
inaccurate
Input #0, h264, from '/Users/mvram/pix/Aspen1Mbps.264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuv420p, 640x480, 25 fps, 25 tbr, 1200k
tbn, 50 tbc
Output #0, mp4, to '/tmp/F1.mp4':
  Metadata:
    encoder         : Lavf54.6.100
    Stream #0:0: Video: h264 (![0][0][0] / 0x0021), yuv420p, 640x480,
q=2-31, 25 fps, 1200k tbn, 1200k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x7f879981d200] pts has no value
    Last message repeated 29 times
frame=   30 fps=0.0 q=-1.0 Lsize=     106kB time=00:00:01.12 bitrate=
776.3kbits/s    
video:105kB audio:0kB global headers:0kB muxing overhead 0.853686%


$ ./ffmpeg -i /tmp/F1.mp4 -vcodec copy -an -y /tmp/F1.h264

ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
  built on Sep 14 2012 10:39:41 with llvm_gcc 4.2.1 (Based on Apple Inc.
build 5658) (LLVM build 2336.9.00)
  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
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/F1.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf54.6.100
  Duration: 00:00:01.20, start: 0.000000, bitrate: 724 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
640x480, 718 kb/s, 25 fps, 25 tbr, 1200k tbn, 2400k tbc
    Metadata:
      handler_name    : VideoHandler
Output #0, h264, to '/tmp/F1.h264':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf54.6.100
    Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p, 640x480,
q=2-31, 718 kb/s, 25 fps, 90k tbn, 1200k tbc
    Metadata:
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=   30 fps=0.0 q=-1.0 Lsize=     105kB time=00:00:01.16 bitrate=
743.2kbits/s    
video:105kB audio:0kB global headers:0kB muxing overhead 0.000000%

$ ./ffmpeg -i /tmp/F1.h264

ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
  built on Sep 14 2012 10:39:41 with llvm_gcc 4.2.1 (Based on Apple Inc.
build 5658) (LLVM build 2336.9.00)
  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
/tmp/F1.h264: Invalid data found when processing input




--
View this message in context: http://ffmpeg-users.933282.n4.nabble.com/Valid-H264-stream-wrapped-in-MP4-cannot-be-converted-back-to-a-valid-H264-stream-tp4653464.html
Sent from the FFmpeg-users mailing list archive at Nabble.com.


More information about the ffmpeg-user mailing list