[FFmpeg-user] Muxing raw H264 to container format (MP4, MOV)

oblivion vlad.ion at gmail.com
Wed Nov 2 10:26:58 CET 2011


Hi,

> ffmpeg -threads 3 -i in.h264 -vcodec mpeg4 -r 25 -sameq outfile.mp4

Thanks  for the help, but as I said I don't want to recompress it, I just
want to mux the original encoded video stream in a container to get seeking
information (hence the "-vcodec copy"). 

I know it works because avc2avi does it, but it outputs AVI 1.0 and I need
AVI 2.0 (or mkv or mp4). I know the video content is ok because I can play
it in vlc and I can read the h264 packets in code.

> I didn't need to " -f h264 " but I did need to force the codec
> which, running the way you expressed it, complained about the
> frame rates being incompatible (and quite rightfully ?? so because MP4
> is only 25 fps ???)

The stream is at about 24fps but that is not the problem really. I can tweak
the frame rate if I get the file to actually mux in the container.

> FWIW, I tried your lines and it "sort of" worked. The '-f h264' was
> needed. There's sound?

There is no sound. The original file is just a raw h264 stream from a
hardware device. I don't need to mux sound in the container at the moment
anyway.

> Perhaps ffprobe -show_streams your_original_infile.xxx ?

The output is one stream, as expected:

Input #0, h264, from 'Anonymous-3-recording.h264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p, 1280x960, 25 fps, 25 tbr,
1200k tb
n, 50 tbc
[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
codec_type=video
codec_time_base=1/50
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=1280
height=960
has_b_frames=0
pix_fmt=yuv420p
level=40
r_frame_rate=50/2
avg_frame_rate=25/1
time_base=1/1200000
start_time=N/A
duration=N/A
[/STREAM]


--
View this message in context: http://ffmpeg-users.933282.n4.nabble.com/Muxing-raw-H264-to-container-format-MP4-MOV-tp3922255p3972300.html
Sent from the FFmpeg-users mailing list archive at Nabble.com.


More information about the ffmpeg-user mailing list