I've looked back through this thread to try to gather the various methods of linux encoding together. (Apologies for cluttering this thread) I'll post them in a separate post once I have everything together.jonny wrote:@Khannie:
(in case you have missed there is also the possibility to compile mencoder with the modified x264 support - so no need to pipe or frameserve)
Jonny: Could you point me to somewhere that I can find the code diff? Or download modified mencoder code? I'd be happy to patch the latest code given a diff, or I can produce a compile guide if you have a link to already modified code. Latest update: Ok, I built mencoder earlier today and realised that it needs a static library from x264, then I remembered the diff for the x264 patch on your homepage in the source directory so I'll try to combine the two later on this evening or early tomorrow and report back.
So here's what I've gathered so far:
Method 1: Named pipe with mplayer (606u's method)
mplayer (unpatched) is used with x264 (patched). A named pipe is created which mplayer frameserves to. The patched x264 binary reads its frames from the named pipe and encodes. mencoder is used to extract audio. pmp_muxer.pl perl script does the muxing of video and audio.
Example:
Code: Select all
FILE_TO_ENCODE=myfile.avi
OUTPUT_FILENAME=myfile
PIPE=/tmp/pipe.y4m
BITRATE=550
rm -f $PIPE
mkfifo $PIPE || exit 1
x264 --pass 1 --stats "$FILE_TO_ENCODE".log --progress --bitrate $BITRATE -A all --level 3 --pictiming --aud --no-psnr \
--thread-input --output "/dev/null" $PIPE &
mplayer -benchmark -nosound -quiet -really-quiet -vo yuv4mpeg:file=$PIPE -vf scale=480:272 "$FILE_TO_ENCODE"
rm -f $PIPE
mkfifo $PIPE || exit 1
x264 --pass 2 --progress --stats "$FILE_TO_ENCODE".log --bitrate $BITRATE -A all --level 3 --pictiming --aud --no-psnr --thread-input --output "$OUTPUT_FILENAME".264 $PIPE &
mplayer -benchmark -nosound -quiet -really-quiet -vo yuv4mpeg:file=$PIPE -vf scale=480:272 "$FILE_TO_ENCODE"
mencoder -quiet -really-quiet "$FILE_TO_ENCODE" -srate 44100 -oac mp3lame -lameopts vol=0:mode=0:cbr:br=128 -ovc copy -of rawaudio -o "$OUTPUT_FILENAME".mp3
pmp_muxer_avc.pl -v "$OUTPUT_FILENAME".264 -a "$OUTPUT_FILENAME".mp3 -o "$OUTPUT_FILENAME".pmp
Basically the same as the mplayer method, but using ffmpeg
example: (I have not tested this)
Code: Select all
mkfifo /tmp/pipe.yuv
ffmpeg -i video.avi -y -an -s 480x272 -r 24000/1001 /tmp/pipe.yuv
x264 --crf 24 -A all --level 3 --pictiming --aud --no-psnr --thread-input --progress --fps 12000/1001 --output video.avi.264 /tmp/pipe.yuv 480x272
Not sure here, I presume you just leave out the mkfifo bit in the previous example. This will result in a large file for certain. Probably multiple gigs. Edit: I tested this with mplayer, and it does work. The resulting file is HUGE. I had 3.6G from a 68M .avi file. I know that 7oby had some problems with the named pipe method method using ffmpeg (a small number of missing frames at the start), but the mplayer named pipe method above does not suffer this issue.
Method 4: Modified Mencoder (uNn99)
I intend giving this method a go to remove the frameserving and to hopefully remove the audio synch issues I have occasionally. Edit: I did some googling last night. Could not find the modified mencoder sources. If all else fails, I will use the diff of Jonny's x264 to try to determine what to do to the mencoder code and test that.
edit: uNn99 has a modified mencoder for windows which produces pmp avc. I've asked for the diff of changes made so I can make a linux version.
Method 5: MediaCoder
Just came across this at MediaCoder.sourceforge.net . Apparantly it works well under wine, though I kept getting crashes with the wine I have installed (which is admittedly about 6 months old now). MediaCoder does support transcoding to PMP AVC. Edit: If you have a recent version of wine installed and have tested this (to produce pmp avc on linux) please report back.