If I record a video with raspivid
, the output doesn't seem to be a perfectly valid video file. I can play it with mplayer
, but Firefox's <video>
tag can't play (although it's supposed to support h264).
If I run a ffmpeg -i out.h264 out.mp4
, the output file can be played by Firefox.
According to mediainfo
, this is the difference between the two files:
General Complete name : out.h264 Format : AVC Format/Info : Advanced Video Codec File size : 230 MiB Video Format : AVC Format/Info : Advanced Video Codec Format profile : [email protected] Format settings, CABAC : Yes Format settings, ReFrames : 1 frame Format settings, GOP : M=1, N=60 Width : 1 920 pixels Height : 1 080 pixels Display aspect ratio : 16:9 Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive
General Complete name : out.mp4 Format : MPEG-4 Format profile : Base Media Codec ID : isom File size : 36.1 MiB Duration : 48s 0ms Overall bit rate : 6 303 Kbps Encoded date : UTC 1904-01-01 00:00:00 Tagged date : UTC 1904-01-01 00:00:00 Writing application : Lavf56.40.101 Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : [email protected] Format settings, CABAC : Yes Format settings, ReFrames : 4 frames Codec ID : avc1 Codec ID/Info : Advanced Video Coding Duration : 48s 0ms Bit rate : 6 302 Kbps Width : 1 920 pixels Height : 1 080 pixels Display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 25.000 fps Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.122 Stream size : 36.1 MiB (100%) Writing library : x264 core 140 Encoding settings : 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=25 / 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 Encoded date : UTC 1904-01-01 00:00:00 Tagged date : UTC 1904-01-01 00:00:00
It seems to me that some kind of header information is missing. Does anybody know an easy way to fix this?