[MPlayer-users] Extract h.264 stream to switch container

162 views
Skip to first unread message

Armelius Cameron

unread,
Mar 23, 2012, 2:23:23 PM3/23/12
to MPlayer usage questions, feature requests, bug reports
Hello,
I have .mov files with h264 video. I want to move this to MP4 or MKV container
but I don't want to re-encode the video. I am trying to use mplayer / mencoder
to extract the stream so that I can use MP4Box from gpac or mkvtools to add
the stream to the container, but I am having trouble figuring out how.
Is this possible at all ? How to do it ?

Thank you very much in advance for any help.

This is what ffmpeg -i give me of the video:

ffmpeg -i movie1.mov
ffmpeg version 0.8.9, Copyright (c) 2000-2011 the FFmpeg developers
<snip>

Seems stream 0 codec frame rate differs from container frame rate: 61440.00
(61440/1) -> 30.00 (30/1)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'movie1.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2011-06-13 14:09:02
Duration: 00:00:01.70, start: 0.000000, bitrate: 30725 kb/s
Stream #0.0(eng): Video: h264 (Main), yuv420p, 1280x1280, 30718 kb/s, 30
fps, 30 tbr, 30720 tbn, 61440 tbc
Metadata:
creation_time : 2011-06-13 14:09:58

AC
_______________________________________________
MPlayer-users mailing list
MPlaye...@mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-users

Carl Eugen Hoyos

unread,
Mar 24, 2012, 4:03:01 AM3/24/12
to mplaye...@mplayerhq.hu
Marco Munderloh <munderl <at> tnt.uni-hannover.de> writes:

> ffmpeg -i video.mov -vcodec copy -acodec copy output.[mkv/mp4]
>
> Newest ffmpeg version has a slightly different interface.

Above line works fine with current FFmpeg.

Carl Eugen

Carl Eugen Hoyos

unread,
Mar 24, 2012, 4:08:45 AM3/24/12
to mplaye...@mplayerhq.hu
Armelius Cameron <armeliusc <at> gmail.com> writes:

> ffmpeg -i movie1.mov
> ffmpeg version 0.8.9, Copyright (c) 2000-2011 the FFmpeg developers

This is outdated.

> <snip>

Both on this list and the FFmpeg mailing lists, please do not cut
the console output (except for repeated lines), but always post
complete, uncut console output.

To extract the h264 stream from mkv:
mplayer file.mkv -dumpvideo
ffmpeg -i file.mkv -vcodec copy out.h264

H264 in mp4 has a special syntax (if the file is valid) and
mplayer file.mp4 -dumpvideo produces an invalid file
ffmpeg -i file.mp4 -vcodec copy -vbsf h264_mp4toannexb out.h264

Carl Eugen

Krzysztof Duchnowski

unread,
Mar 24, 2012, 4:39:02 AM3/24/12
to MPlayer usage questions, feature requests, bug reports
On 23.03.2012 19:23, Armelius Cameron wrote:
> Hello,
> I have .mov files with h264 video. I want to move this to MP4 or MKV container
> but I don't want to re-encode the video. I am trying to use mplayer / mencoder
> to extract the stream so that I can use MP4Box from gpac or mkvtools to add
> the stream to the container, but I am having trouble figuring out how.
> Is this possible at all ? How to do it ?


Last time I've checked (today), it worked that way:

> $ MP4Box -add bbc-blue_m1080p.mov bbc.mp4
> IsoMedia import - track ID 1 - Audio (SR 44100 - 2 channels)
> IsoMedia import - track ID 2 - Video (size 1920 x 1072)
> Saving to bbc.mp4: 0.500 secs Interleaving

And you could check whatever GPAC recognizes streams in your file by:

> $ MP4Box -info bbc-blue_m1080p.mov
> * Movie Info *
> Timescale 600 - Duration 00:03:22.165
> Fragmented File no - 2 track(s)
> File suitable for progressive download (moov before mdat)
> File Brand qt - version 537199360
> Created: GMT Fri May 4 18:32:15 2007
>
> File has no MPEG4 IOD/OD
>
> Track # 1 Info - TrackID 1 - TimeScale 44100 - Duration 00:03:22.176
> Media Info: Language "Undetermined" - Type "soun:mp4a" - 8707 samples
> MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
> MPEG-4 Audio MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 44100
> Self-synchronized
>
> Track # 2 Info - TrackID 2 - TimeScale 600 - Duration 00:03:22.165
> Media Info: Language "Undetermined" - Type "vide:avc1" - 6065 samples
> Visual Track layout: x=0 y=0 width=1920 height=1072
> MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
> AVC/H264 Video - Visual Size 1920 x 1072
> AVC Info: 1 SPS - 1 PPS - Profile Main @ Level 4.1
> NAL Unit length bits: 32
> Synchronized on stream 1

So extracting just a video stream would be:

> $ MP4Box -add bbc-blue_m1080p.mov#video h264.mp4
> IsoMedia import - track ID 2 - Video (size 1920 x 1072)
> Saving to h264.mp4: 0.500 secs Interleaving

--
Krzysztof 'DK75' Duchnowski
GetFirefox - http://www.getfirefox.net/
Konfiguracja UTF-8 dla czytników - http://evil.pl/pip/utf/

Reply all
Reply to author
Forward
0 new messages