View Full Version : Generating input for x264 executable
ga82
1st October 2005, 18:51
Hi,
This is a simple problem but has been bugging me a lot. My aim is to use the x264 executable in Linux. I am unable to generate the proper input file using mencoder. I tried with
mencoder -ovc raw -o test.yuv -nosound a.avi
and recompressed using
x264 -v -q 20 -o o.mkv test.yuv 640x352
but while I can see correctly test.yuv, o.mkv is having bad colour and bad frame boundaries.
What parameters should I pass to mencoder to get the proper output? In addition, how can I use advantage of pipes to avoid impractical file sizes?
Please help.
Thanks in advance.
ak
2nd October 2005, 00:29
I think it'll be
> ffmpeg -i a.avi -f rawvideo -r <fps> - | x264 -v -q 20 -o o.mkv - 640x352
As for mencoder, I doubt you can use it in pipes.
ac-chan123
2nd October 2005, 06:23
g/.mkv/.[h]+264
x264 don't create matroska files. It creates raw h.264(aka. ISO/IEC 14496 Part 10 Advanced Video Coding) stream. therefor it is better to use ".h264" or "264" as file extention.
Under UNIX and UNIX like systems is no need for a file extention(use magic). ;)
ga82
2nd October 2005, 06:39
I think it'll be
> ffmpeg -i a.avi -f rawvideo -r <fps> - | x264 -v -q 20 -o o.mkv - 640x352
As for mencoder, I doubt you can use it in pipes.
How about fifo files? I currently use them for audio compression. How can I use them and stick with mencoder? I want to avoid one more dependency.
akupenguin
2nd October 2005, 08:00
Yes, you can use fifos.
g/.mkv/.[h]+264
x264 don't create matroska files. It creates raw h.264
x264 does create matroska files if you tell it to. And the way you tell it is by naming the output file *.mkv
ak
2nd October 2005, 11:03
How about fifo files? I currently use them for audio compression. How can I use them and stick with mencoder? I want to avoid one more dependency.
Hm, mencoder can do x264 encoding directly (-ovc x264).
For fifos you probably want to add '-of rawvideo -vf format=i420' to commandline.
Doom9
2nd October 2005, 13:31
mencoder also supports stdin piping but since it can be compiled with x264 support, it's kinda redundant in this case.
nm
2nd October 2005, 14:04
AFAIK, at the moment Mencoder only supports AVC output in AVI container or as a raw stream (perhaps in some MPEG container too). Getting that output into Matroska properly is also not possible without external tools since mkvmerge only supports importing AVC streams from MP4 container.
For some reason I haven't managed to get the conversion from Mencoder-generated raw AVC to Matroska through MP4 to work. Playing back the resulting Matroska file is very slow as if the framerate was wrong. Still the raw stream and .mp4 work just fine when played back with MPlayer. And I did specify the framerate for raw AVC to MP4 conversion. It could be my 64-bit system and some bug in mkvmerge, but I haven't got the time to investigate closer. For now I've just forced mkvmerge to accept the AVC in AVI input to mux with Vorbis audio. It works fine as long as I take the few dropped frames in the beginning of the video track into account to sync with audio.
It probably won't take long to have direct Matroska output support in Mencoder, but in the meantime, using it to output raw video to the x264 encoder is probably the best way to get the video into Matroska.
stephanV
2nd October 2005, 14:08
Playing back the resulting Matroska file is very slow as if the framerate was wrong.
Known bug with Mplayer, you can use the -fps switch to fix it or use a player that does have proper Matroska support. From what I've heard this won't be fixed any time soon.
It probably won't take long to have direct Matroska output support in Mencoder,
Unless you are gonna write it, it probably will take long I'm afraid.
nm
2nd October 2005, 15:29
Known bug with Mplayer, you can use the -fps switch to fix it or use a player that does have proper Matroska support. From what I've heard this won't be fixed any time soon.
Ok, I searched the MPlayer mailing lists and found this:
http://mplayerhq.hu/pipermail/mplayer-users/2005-September/055704.html
Contrary to that case, I haven't used timecodes at all, but the result seems to be the same. Is there more information on this issue readily available elsewhere? If this starts to bug me enough, I might look into fixing the problem.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.