Log in

View Full Version : how can I extract H.264 raw stream like slice from a File,.mov etc.?


hysx
21st April 2006, 05:57
thank you.Could I use FFMPEG's API for extracting?:thanks:

hitbit
21st April 2006, 08:41
mencoder.exe YourFile.mov -nosound -ovc copy -of rawvideo -o video.264

hysx
21st April 2006, 15:00
how could i use the mencoder's API for extracting a slice to a binary file? THX

hitbit
22nd April 2006, 07:49
mmmm... what you mean with "a slice"?

akupenguin
22nd April 2006, 08:15
mencoder.exe YourFile.mov -nosound -ovc copy -of rawvideo -o video.264
Doesn't work on mov/mp4/mkv because they use a different a different encapsulation of the packets.

MP4Box -raw
or
mkvmerge ; mkvextract

hitbit
22nd April 2006, 08:43
oops! You're right. I've never tried it before...

hysx
22nd April 2006, 10:46
i want to do a program with ffmpeg to extract some slice I or P from .mov or mp4 etc.So I want to know how to do.

hysx
23rd April 2006, 13:03
up up,i am waiting

SeeMoreDigital
23rd April 2006, 13:52
YAMB 1.6 (with MP4box) is be able to extract h.264 video and AAC audio streams out of the MOV container ;)

bond
24th April 2006, 18:01
moved

(mplayer does it too)

hitbit
25th April 2006, 11:50
(mplayer does it too)

I think not, I tried it (with mplayer -dumpvideo) and seems to have the same issues as mencoder (see aku's post).
Besides, I've been thinking for days what does he means with "extracting some I or P slices".
Maybe he means extracting single frames? In raw compressed format???:confused:

bond
1st May 2006, 17:01
i am pretty sure mplayer does it too :search:

jbeale
18th May 2006, 18:21
I have an AVI video in H.264 format. It was encoded through VirtualDub 1.6.11 using the x264 codec at 1280x720p, 29.97 fps. It has 211564 frames, duration 01:57:39, filesize 4,216,608 KB. It took about 36 hours to do this encode (from my HDV 1080i original) and I'd like to avoid re-encoding. This AVI has no sound but the video looks fine, in the sense that Nero Showtime 2 plays it with no problems.

I have the audio track in a separate .mp4 file. I want to mux them together for a final MP4 with both audio and video. YAMB wants raw H.264 instead of AVI before muxing, so I split out a raw 264 file with

mencoder.exe MyVideo-720p.avi -nosound -ovc copy -of rawvideo -o H:\MyVideo.264

BUT the MyVideo.264 file I get is only 2 GB , with less than half the number of frames in the original AVI. Is there some 2 GB filesize limit with mencoder? Any advice? Should I be going about this in a different way? I'm running WinXP with NTFS filesystems and have 181 GB disk space free on the target H: drive.
-----

AVI file format detected.
VIDEO: [H264] 1280x720 24bpp 29.970 fps 2411.8 kbps (294.4 kbyte/s)
[...]
Video stream: 4912.187 kbit/s (614023 B/s) size: 2128962649 bytes 3467.234 se cs 103913 frames

mencoder version:
-----------------
MEncoder dev-CVS-050928-16:38-3.4.2 (C) 2000-2005 MPlayer Team
CPU: Intel Pentium 4/Xeon/Celeron Foster (Family: 8, Stepping: 9)
Detected cache-line size is 64 bytes
CPUflags: Type: 8 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 0 SSE2: 0

bond
18th May 2006, 18:36
avi2raw does it

jbeale
18th May 2006, 19:12
avi2raw does it

Thanks for the quick response! I tried this but it doesn't seem to work:

E:\>avi2raw -help
avi2raw - mpeg4ip version 1.4.1
[...]
E:\>avi2raw --video MyVideo-720p.avi h:\MyVideo.264
-----------

It generated no output file and no command-line output, but it did consume 50% of CPU for several minutes and used up a lot of memory, over 1.2 GB of memory (!) before disk swapping started and I killed the process. Still no output file at all.

I just want to unpack the AVI wrapper and export the raw H.264 stream to disk. I think there is some problem, it should not need over 1 GB of memory to do this? Thanks!
-------------
Update: I generated a short 400 frame x264 AVI and avi2raw works just fine with it. My guess is that avi2raw reads the ENTIRE INPUT FILE into memory first, and only then starts exporting it. That method is fine for short files and unsuitable for 4 GB size files (at least on my system!)

E:\>avi2raw --video 400frames.avi h:\400raw.264
avi2raw - mpeg4ip version 1.4.1
avi2raw: warning: 2 zero length frames ignored
398 video frames written

bond
18th May 2006, 19:52
there are problems with avi files bigger than 4gb, dont use those

jbeale
18th May 2006, 21:06
My H264 format AVI is 4.02 GB (4,317,806,216 bytes) and Nero Showtime 2 plays it 100% OK from beginning to end. There are no errors or problems in playback, so I believe that is evidence that there is nothing wrong with the AVI, although it is slightly over 4.00 GB in size.

Neither of the tools I have tried (mencoder, avi2raw) work with this file, but if anyone knows of a program which can extract the raw H264 stream out of this file, I'd be interested to know. Thanks!

hitbit
20th May 2006, 06:58
Try mplayer:
mplayer yourFile.avi -dumpvideo -dumpfile out.264

GodofaGap
20th May 2006, 08:57
Avi files larger than 4GB should be ok. It could be that avi2raw doesn't support opendml though.

@jbeale: are you sure mplayer/mencoder is compiled with --enable-largefiles?