[FFmpeg-user] h264 file: mplayer plays it, but ffmpeg can't decode it

Bryan Field-Elliot bryanfieldelliot at gmail.com
Tue Nov 18 06:05:34 CET 2014


I have a h264 file, which I obtained by capturing bytes streaming (mid-stream) from an IP camera.  

mplayer has no trouble playing the file on-screen.  However, I cannot seem to get ffmpeg to recognize and decode the file (or re-encode it into something else), no matter what combination of command line parameters I try.

Example output from ffmpeg is below. As I said, these are h264 bytes captured mid-stream, not necessarily on the key frame boundary.  mplayer (with no other options) plays the video just fine, which leads me to believe it is essentially valid. But for someone reason ffmpeg can’t figure it out.

Help would be appreciated! Thank you.

$ ffmpeg
ffmpeg version 2.4.3 Copyright (c) 2000-2014 the FFmpeg developers
  built on Nov 11 2014 11:21:43 with Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.4.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-ffplay --enable-vda
  libavutil      54.  7.100 / 54.  7.100
  libavcodec     56.  1.100 / 56.  1.100
  libavformat    56.  4.101 / 56.  4.101
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  1.100 /  5.  1.100
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'



$ ffmpeg -f h264 -i vid.h264 -c:v libx264 vid.mp4

(much omitted...)

[h264 @ 0x7ffdb982e200] no frame!
[h264 @ 0x7ffdb982e200] Missing reference picture, default is 0
[h264 @ 0x7ffdb982e200] decode_slice_header error
[h264 @ 0x7ffdb982e200] Missing reference picture, default is 0
[h264 @ 0x7ffdb982e200] decode_slice_header error
[h264 @ 0x7ffdb982e200] Missing reference picture, default is 0
[h264 @ 0x7ffdb982e200] decode_slice_header error
[h264 @ 0x7ffdb982e200] Missing reference picture, default is 0
[h264 @ 0x7ffdb982e200] decode_slice_header error
[h264 @ 0x7ffdb980da00] decoding for stream 0 failed
Input #0, h264, from 'vid.h264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuvj420p(pc), 640x480 [SAR 1:1 DAR 4:3], 15.33 fps, 15 tbr, 1200k tbn, 30 tbc
No pixel format specified, yuvj420p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x7ffdba012800] using SAR=1/1
[libx264 @ 0x7ffdba012800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7ffdba012800] profile High, level 2.2
[libx264 @ 0x7ffdba012800] 264 - core 142 r2455 021c0dc - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=15 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'vid.mp4':
  Metadata:
    encoder         : Lavf56.4.101
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 15 fps, 15360 tbn, 15 tbc
    Metadata:
      encoder         : Lavc56.1.100 libx264
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[h264 @ 0x7ffdba524800] Cannot use next picture in error concealment
[h264 @ 0x7ffdba524800] concealing 880 DC, 880 AC, 880 MV errors in P frame
frame=    0 fps=0.0 q=0.0 Lsize=       0kB time=00:00:00.00 bitrate=N/A    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown



The resulting file, vid.mp4, is only 261 bytes long and (obviously) doesn’t play.


More information about the ffmpeg-user mailing list