Log in

View Full Version : Encode using Mplayer + x264


Lele-brz
13th March 2008, 11:51
Hi all,
I hope this wasn't already discussed, if so please redirect me to the proper thread.
I'd like to use Mplayer as a source for encoding with x264.

I tried on Linux creating a pipe as suggested on http://gentoo-wiki.com/HOWTO_Rip_DVD_mencoder


mkfifo stream.y4m

mplayer -nosound -noframedrop -noautosub -vo yuv4mpeg:file=stream.y4m dvd://1

x264 --progress -o dvd1.mp4 stream.y4m


But my video has strange colors and it keeps panning from right to left.

Then I'd like to know if I can do the same on Windows, has someone already tried?

Thanks a lot in advance
Bye

nm
13th March 2008, 12:54
Those commands work perfectly fine for me with latest x264 git and MPlayer SVN versions (except that x264 wanted me to specify a ratecontrol method, like --crf 20, and I don't have x264 compiled with MP4 support). Make sure you have the latest versions of the programs.

Another option would be to just use MEncoder, output a raw H.264 stream (-of rawvideo -o file.264) and mux it to MP4 with external tools.

Lele-brz
13th March 2008, 13:23
Hi thanks for that,
I think I'll try to use a real Linux rather than a VMWare Image.
And how can I do the same on Windows?

valgor
13th March 2008, 14:09
>> And how can I do the same on Windows?

just the same way.
mplayer and x264 are cross-platform tools

Lele-brz
13th March 2008, 14:34
but not mkfifo...

J_Darnley
13th March 2008, 15:17
You need to use a pipe on Windows and then specify the frame dimensions after the filename in x264's, e.g mplayer | x264 -o file.mp4 - 720x576

Lele-brz
13th March 2008, 15:55
I tried with:


mplayer -vo yuv4mpeg c:\output.mpg | x264.exe
--crf 0.26 --verbose --progress -o "C:\mcstream4812.264" - 576x320


But it got stuck without doing anything, some idea?
thanks

J_Darnley
14th March 2008, 01:35
Sorry good clues, but probably lies with mplayer. I would guess that you need to specify that stdout should be used.

On an unrelated note, --crf 0.26 will produce very large files as quantiser 0 in x264 is its lossless mode and to get an average/nominal qp of 0.26 it will alternate between one and zero. Do you mean --crf 26?

Lele-brz
14th March 2008, 10:17
thanks,
about x264 parameters this is not what I'm using, generally I do 2pass ABR encoding with other settings.

So about Windows I can always use AVS input, but I would like to use mplayer to avoid checking the codecs installed on that particular machine.

I'll try to undestand how to specify the stdout in mplayer...

Dark Shikari
14th March 2008, 10:26
I'll try to undestand how to specify the stdout in mplayer...Use named pipes, e.g. mkfifo.

Lele-brz
14th March 2008, 10:35
I'm looking for the "mkfifo" on Windows...
not found yet

CruNcher
14th March 2008, 10:41
Mediacoder i think uses a special mplayer/mencoder build that fixes all the pipe issues under windows tough last tests i did (tough that was long time ago) showed that frames where missing in the bitstream so i skiped it after reporting that in the forum and nothing was done, you should try it maybe it works correctly now :)

Dark Shikari
14th March 2008, 10:41
I'm looking for the "mkfifo" on Windows...
not found yetTry cygwin.

buzzqw
14th March 2008, 10:45
@Lele-brz

http://technet.microsoft.com/en-us/library/bb490982.aspx

BHH

nm
14th March 2008, 10:55
I tried with:


mplayer -vo yuv4mpeg c:\output.mpg | x264.exe
--crf 0.26 --verbose --progress -o "C:\mcstream4812.264" - 576x320


But it got stuck without doing anything, some idea?
thanks
-vo yuv4mpeg writes to stream.yuv by default, and I don't think you can make it write to standard output. Instead, try this with MEncoder:mencoder inputfile -really-quiet -nosound -ovc raw -vf format=i420 -of rawvideo -o - | x264 -o output.264 --crf 22 - 720x576

But it's easier to encode with mencoder -ovc x264 directly (no need to specify frame size). The only reason to call x264 separately is to set the parameters of patched x264 features that are not accessible through MEncoder's x264encopts.

Lele-brz
14th March 2008, 11:29
Thanks a lot,


mencoder inputfile -really-quiet -nosound -ovc raw -vf format=i420 -of rawvideo -o - | x264 -o output.264 --crf 22 - 720x576


that works perfectly under Windows, I'll try the same under Linux
where I have the panning issue on the encoded.

Lele-brz
14th March 2008, 12:09
The only problem I have now, using mencoder | x264 is that the scaling is not working properly.
When I do that like this:


mencoder inputfile -really-quiet -nosound -ovc raw -vf scale=640:480 format=i420 -of rawvideo -o - | x264 -o output.264 --crf 22 - 640x480


The resulting video has many greeen flashes.

nm
14th March 2008, 12:23
You forgot to put a comma between filters:
-vf scale=640:480,format=i420

Lele-brz
14th March 2008, 12:33
yes, thanks.
I found it using MediaCoder with the console window opened, it seems MediaCoder uses the "pipe" option.

Lele-brz
14th March 2008, 14:09
For those interested I did the same on Ubuntu using a named pipe:


mkfifo test.yuv

mencoder input.mpg -really-quiet -nosound -ovc raw -vf format=i420 -of rawvideo -o test.yuv

x264 --progress --bitrate 1200 -o test2.mkv test.yuv 480x360


Thanks for your help