[MPlayer-users] How do you play raw h.264 files in mplayer?

David wizzardx at gmail.com
Fri Aug 12 11:04:23 CEST 2011


Hi there.

I want to play a raw .h264 file in mplayer, but I can't find the syntax for it.

I can get ffplay to do it, eg:

1. Tidy up the stream a bit (strip out leading corrupt data):

ffmpeg -f h264 -i test.h264 -vcodec copy -y out.h264

2. Play it:

ffplay out.h264

That plays fine (except that the video is too fast, I also need to
find a way to slow down the playback FPS of the raw h264 stream from
50 fps to 25 fps).

However, mplayer can't play the file, it gets a garbled/corrupt screen
when I try this:

mplayer out.h264

And a large amount of errors, here is part of my mplayer output:

--------------
MPlayer SVN-r33367 (C) 2000-2010 MPlayer Team
Can't open joystick device /dev/input/js0: No such file or directory
Can't init input joystick
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing out.h264.
H264-ES file format detected.
FPS not specified in the header or invalid, use the -fps option.
Load subtitles in ./
open: No such file or directory
[MGA] Couldn't open: /dev/mga_vid
open: No such file or directory
[MGA] Couldn't open: /dev/mga_vid
[VO_TDFXFB] Can't open /dev/fb0: No such file or directory.
s3fb: can't open /dev/fb0: No such file or directory
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
Audio: no sound
Starting playback...
[h264 @ 0x8ab2d40]no frame!
Error while decoding frame!
[h264 @ 0x8ab2d40]no frame!
Error while decoding frame!
[h264 @ 0x8ab2d40]no frame!
Error while decoding frame!
[h264 @ 0x8ab2d40]no frame!
Error while decoding frame!
[h264 @ 0x8ab2d40]no frame!
Error while decoding frame!
[h264 @ 0x8ab2d40]no frame!
Error while decoding frame!
[h264 @ 0x8ab2d40]no frame!
Error while decoding frame!
[h264 @ 0x8ab2d40]no frame!
Error while decoding frame!
[h264 @ 0x8ab2d40]non-existing PPS 0 referenced
[h264 @ 0x8ab2d40]decode_slice_header error
[h264 @ 0x8ab2d40]no frame!
Error while decoding frame!
[h264 @ 0x8ab2d40]non-existing PPS 0 referenced
[h264 @ 0x8ab2d40]decode_slice_header error
[h264 @ 0x8ab2d40]non-existing PPS 0 referenced
[h264 @ 0x8ab2d40]decode_slice_header error
[h264 @ 0x8ab2d40]no frame!
Error while decoding frame!
[h264 @ 0x8ab2d40]non-existing PPS 0 referenced
--------------

And the a bit later on:

--------------
[h264 @ 0x8ab2d40]non-existing PPS 0 referenced
[h264 @ 0x8ab2d40]decode_slice_header error
[h264 @ 0x8ab2d40]no frame!
Error while decoding frame!
Unsupported PixelFormat 61
Unsupported PixelFormat 53
[h264 @ 0x8ab2d40]Invalid level prefix
[h264 @ 0x8ab2d40]error while decoding MB 15 1
[h264 @ 0x8ab2d40]concealing 396 DC, 396 AC, 396 MV errors
Movie-Aspect is undefined - no prescaling applied.
VO: [vdpau] 352x288 => 352x288 Planar YV12
V:   0.0   0/  0 ??% ??% ??,?% 0 0 ^[[J^M
[h264 @ 0x8ab2d40]no frame!
Error while decoding frame!
[h264 @ 0x8ab2d40]no frame!
Error while decoding frame!
[h264 @ 0x8ab2d40]no frame!
--------------

A bit further:

--------------
[h264 @ 0x8ab2d40]no frame!
Error while decoding frame!
[h264 @ 0x8ab2d40]no frame!
Error while decoding frame!
[h264 @ 0x8ab2d40]Invalid level prefix
[h264 @ 0x8ab2d40]error while decoding MB 9 2
[h264 @ 0x8ab2d40]concealing 392 DC, 392 AC, 392 MV errors
V:   0.0   0/  0 ??% ??% ??,?% 0 0 ^[[J^M
[h264 @ 0x8ab2d40]corrupted macroblock 1 17 (total_coeff=-1)
[h264 @ 0x8ab2d40]error while decoding MB 1 17
[h264 @ 0x8ab2d40]concealing 70 DC, 70 AC, 70 MV errors
V:   0.0   0/  0 ??% ??% ??,?% 0 0 ^[[J^M
[h264 @ 0x8ab2d40]cbp too large (4294967295) at 14 3
[h264 @ 0x8ab2d40]error while decoding MB 14 3
[h264 @ 0x8ab2d40]concealing 365 DC, 365 AC, 365 MV errors
V:   0.0   0/  0 ??% ??% ??,?% 0 0 ^[[J^M
[h264 @ 0x8ab2d40]corrupted macroblock 15 16 (total_coeff=-1)
[h264 @ 0x8ab2d40]error while decoding MB 15 16
[h264 @ 0x8ab2d40]concealing 78 DC, 78 AC, 78 MV errors
V:   0.0   0/  0 ??% ??% ??,?% 0 0 ^[[J^M
[h264 @ 0x8ab2d40]negative number of zero coeffs at 11 10
[h264 @ 0x8ab2d40]error while decoding MB 11 10
[h264 @ 0x8ab2d40]concealing 214 DC, 214 AC, 214 MV errors
V:   0.0   0/  0 ??% ??% ??,?% 0 0 ^[[J^M
[h264 @ 0x8ab2d40]cbp too large (4294967295) at 2 16
[h264 @ 0x8ab2d40]error while decoding MB 2 16
--------------

Is there any way I can make mplayer decode and play "out.h264" the
same way that ffplay does?

And in case you're wondering why I want to play a raw h.264 file
instead of from a container like .mp4:

I have a device (a security camera DVR) which sends it's data to the
PC over the network in a h.264 format.

I can take that h.264 data for a few seconds, and then use ffmpeg to
convert it into a .mp4 file which mplayer can play (I think that
ffmpeg does a lot of tidying-up of the .h264 data, and adds some
metadata). But I actually want to play that stream in mplayer in
realtime, rather than later.

So basically I want to do use this logic:

1. My app uses the DVR API to get the h264 stream, and writes that to
a named pipe.

2. Run mplayer with the correct options to play that h264 stream from
the named pipe.

Any advice?

Regards,

David.


More information about the MPlayer-users mailing list