Extracting row video for x264 encoding
Hi there ! I'm trying to encode some videos using this way : Extract raw audio, use faac to encode Extract raw video, use x264 to encode box them together as mp4. I'm using mplayer and faac for the audio, it works :) I'm using mencoder and x264 for video : I got problems with framrates : videos outputs are randomly (depending of the input) [normal | a bit fast | 2x too fast] My current try is : mencoder source_file dsize=650:366:0,scale=0:0,expand=650:366,dsize=1.5,format=i420 -nosound -ovc raw -of rawvideo -ofps 25 video.yuv then x264 video.yuv -o --fps 25 --profile baseline --level 3 --no-fast-pskip --vbv-maxrate 512 --vbv-bufsize 512 --partitions all --no-cabac --me tesa --subme 10 --input-res 650x366 video.h264 I want to force ~25 FPS on output, I don't need more ... but i got this a/v desync. Any idea ?
On 2011.03.29 12:17 PM, Julien Palard wrote:
Hi there !
I'm trying to encode some videos using this way :
Extract raw audio, use faac to encode Extract raw video, use x264 to encode box them together as mp4. Why encode them separately? You can use MEncoder to process both at the same time (which is a lot more stable as far as A/V sync is concerned). You can always remux the output with MP4Box if necessary.
On Tue, Mar 29, 2011 at 9:48 PM, Andrew Berg <bahamutzero8825@gmail.com> wrote:
Why encode them separately? You can use MEncoder to process both at the same time
I just tried mencoder $INPUT_FILE -oac mp3lame -vf dsize=650:366:0,scale=0:0,expand=650:366,dsize=1.5,format=i420 -ovc x264 -x264encopts profile=baseline:no-cabac:me=tesa:vbv-bufsize=512:vbv-maxrate=512:subme=10:partitions=all:level=3:no-fast-pskip -o $OUTPUT_FILE and it worst the resulting video plays 2x too fast )o:
On Wed, Mar 30, 2011 at 10:31 AM, Julien Palard <mencoder@mandark.fr> wrote:
On Tue, Mar 29, 2011 at 9:48 PM, Andrew Berg <bahamutzero8825@gmail.com> wrote:
Why encode them separately? You can use MEncoder to process both at the same time
I just tried mencoder $INPUT_FILE -oac mp3lame -vf dsize=650:366:0,scale=0:0,expand=650:366,dsize=1.5,format=i420 -ovc x264 -x264encopts profile=baseline:no-cabac:me=tesa:vbv-bufsize=512:vbv-maxrate=512:subme=10:partitions=all:level=3:no-fast-pskip -o $OUTPUT_FILE
and it worst the resulting video plays 2x too fast )o:
add to x264encopts the option force_cfr and also add the correct fps with -fps and -ofps, if needed
_______________________________________________ MEncoder-users mailing list MEncoder-users@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
Hi, On Wed, Mar 30, 2011 at 11:15 AM, Grozdan <neutrino8@gmail.com> wrote:
add to x264encopts the option force_cfr and also add the correct fps with -fps and -ofps, if needed
I just tried as you said : mencoder $INPUT -oac mp3lame -vf dsize=650:366:0,scale=0:0,expand=650:366,dsize=1.5,format=i420 -ofps 25 -ovc x264 -x264encopts profile=baseline:no-cabac:me=tesa:vbv-bufsize=512:vbv-maxrate=512:subme=10:partitions=all:level=3:no-fast-pskip:force_cfr -o $OUTPUT But the video plays 2x too fast (plays in 7 seconds, original lenghts 13s) Some tests i made give me a video of 16s, the sound is good but the video a little bit too slow ... What do you mean by "the correct fps" ? As i have a range of very different video as input, i don't have a constant FPS at input... in this case, does mencoder read the fps of the container which can be wrong leading to this kind of problem ? Typically ffmpeg -i $INPUT outputs some strange bits : Seems stream 0 codec frame rate differs from container frame rate: 59.83 (29917/500) -> 59.75 (239/4) Stream #0.0(und): Video: h264, yuv420p, 640x360 [PAR 1:1 DAR 16:9], 646 kb/s, 29.92 fps, 59.75 tbr, 1k tbn, 59.83 tbc Codec frame rate and Container frame rate at 59.83 and 59.75 and video stream frame rate at 29.92fps, can this lead to my problem ?
What do you mean by "the correct fps" ? As i have a range of very different video as input, i don't have a constant FPS at input... in this case, does mencoder read the fps of the container which can be wrong leading to this kind of problem ? That's possible. If your input is an MPEG-TS container, add -demuxer lavf (lavf is much better with MPEG-TS than the default). Also try remuxing the input before sending it to MEncoder (the original muxer may be broken; there are plenty of good muxers out there for the various containers). Typically ffmpeg -i $INPUT outputs some strange bits : Seems stream 0 codec frame rate differs from container frame rate: 59.83 (29917/500) -> 59.75 (239/4) Stream #0.0(und): Video: h264, yuv420p, 640x360 [PAR 1:1 DAR 16:9], 646 kb/s, 29.92 fps, 59.75 tbr, 1k tbn, 59.83 tbc Those are some very odd frame rates. If those are in fact the correct constant frame rates, then use them with -fps and -ofps (you can pass
On 2011.03.30 04:37 AM, Julien Palard wrote: the frame rate as an argument to your script). If your input has a variable frame rate, you're going to have a lot of trouble getting MEncoder to process it.
On Wed, Mar 30, 2011 at 4:42 PM, Andrew Berg <bahamutzero8825@gmail.com> wrote:
If your input has a variable frame rate, you're going to have a lot of trouble getting MEncoder to process it.
I have some videos using variable frame rate, in my input collection, there isn't any way to process them ? )o:
On Wed, Mar 30, 2011 at 10:02 AM, Julien Palard <mencoder@mandark.fr> wrote:
On Wed, Mar 30, 2011 at 4:42 PM, Andrew Berg <bahamutzero8825@gmail.com> wrote:
If your input has a variable frame rate, you're going to have a lot of trouble getting MEncoder to process it.
I have some videos using variable frame rate, in my input collection, there isn't any way to process them ? )o: _______________________________________________
Handbrake. -- /re
On Tue, Mar 29, 2011 at 07:17:30PM +0200, Julien Palard wrote:
My current try is : mencoder source_file dsize=650:366:0,scale=0:0,expand=650:366,dsize=1.5,format=i420 -nosound -ovc raw -of rawvideo -ofps 25 video.yuv
It's possible "-oac raw" instead of -nosound might work better, even if it is a bit nonsensical.
On Tue, Mar 29, 2011 at 9:48 PM, Andrew Berg <bahamutzero8825@gmail.com> wrote:
Why encode them separately? You can use MEncoder to process both at the same time (which is a lot more stable as far as A/V sync is concerned). You can always remux the output with MP4Box if necessary.
Cause I want a full control on the parameters of x264 and faac (I'm coming from ffmpeg and the x264 parameters mapping is unusable for my needs), but if you're saying that it's easy to have an encoding exactly as I do it using x264 (using vbv-bufsize etc) i'll try to switch. On Tue, Mar 29, 2011 at 10:06 PM, Reimar Döffinger <Reimar.Doeffinger@gmx.de> wrote:
It's possible "-oac raw" instead of -nosound might work better, even if it is a bit nonsensical.
You mean -oac copy ? With -oac copy i got : Audio format 0x4134504d is incompatible with '-oac copy', please try '-oac pcm' instead or use '-fafmttag' to override it. So i tried -oac copy -fafmttag 0x55 But I got the exact same problem of video speed
participants (5)
-
Andrew Berg -
Grozdan -
Julien Palard -
Reimar Döffinger -
Rolf Ernst