njustn
27th October 2006, 13:17
I've been working on a script to automate handling of episodic content and I'm getting very interesting results with the compression. I'm using x264 cli on linux and mplayer or transcode to create the raw y4m.
At first I was only using mplayer, but i've been trying to port it to work on both linux and osx, which meant make mencoder unnecessary, and I noticed that using transcode piped into x264 was creating files a third again as large and the command i was using was designed to be identical to the mencoder command.
mencoder -nosound -aspect 4:3 -of rawvideo -ovc x264 -vf yadif -x264encopts crf=23:trellis=1:frameref=3:bframes=5:b_adapt:b_pyramid:weight_b:mixed_refs:4x4mv:subq=6:threads=4 -ofps 29.970 -o mencoder.264 ./vob/*.vob
mkfifo video.fifo.y4m
transcode -i ./vob/ -o video.fifo.y4m -x vob -y yuv4mpeg,null
x264 --crf 23 --trellis 1 --ref 3 --bframes 5 --b-pyramid --weightb --mixed-refs --analyse all --8x8dct --threads 4 --fps 29.970 -o x264-cli.264 video.fifo.y4m 720x480
with these two commands, given the same ~140 second chunk of video (anime content in case it might matter), i got the following results
mencoder.264 15M
x264-cli.264 20M
As one might expect, this left me mightily confused, i opened both results in vim to read the options, and the only differences were in analyse, 8x8dct (causes mencoder to crash for some reason) and deadzone. So, I continued testing trying to get things in sync, but nothing would close the gap, so finally i tried the following mencoder line to see what would happen.
mencoder -nosound -aspect 4:3 -of rawvideo -ovc x264 -x264encopts crf=23:trellis=1:frameref=3:bframes=5:b_adapt:b_pyramid:weight_b:mixed_refs:4x4mv:subq=6:threads=4 -ofps 29.970 -o mencoder2.264 ./vob/*.vob
mencoder2.264 20M
note that the only difference is the removal of the yadif deinterlacing filter. At that point I assumed perhaps there was a problem in the compression for interlaced content, and so tried transcode with the tomsmocomp deinterlacer as in the following.
mkfifo video.fifo.y4m
transcode -j tomsmocomp -i ./vob/ -o video.fifo.y4m -x vob -y yuv4mpeg,null
x264 --crf 23 --trellis 1 --ref 3 --bframes 5 --b-pyramid --weightb --mixed-refs --analyse all --8x8dct --threads 4 --fps 29.970 -o x264-cli2.264 video.fifo.y4m 720x480
x264-cli2.264 20M
So, at this point I'm wondering if there's some variable I have failed to consider, or if yadif has some kind of particular worth as a pre-encode filter for x264, has anyone had similar experiences?
The raw chunk used in these tests is 137M in vob form, if anyone is sufficiently interested i can post the chunk, but i imagine the results will hold at least for any given animated content. Please tell me what your thoughts are because I am still... perplexed.
Also, if anybody is aware of another script or program designed to handle episodic content i would like to know of it (automatically batch encoding along episode boundaries and so forth and so on), and on a side note, can anyone recommend a custom matrix for mid-quality animated content?
At first I was only using mplayer, but i've been trying to port it to work on both linux and osx, which meant make mencoder unnecessary, and I noticed that using transcode piped into x264 was creating files a third again as large and the command i was using was designed to be identical to the mencoder command.
mencoder -nosound -aspect 4:3 -of rawvideo -ovc x264 -vf yadif -x264encopts crf=23:trellis=1:frameref=3:bframes=5:b_adapt:b_pyramid:weight_b:mixed_refs:4x4mv:subq=6:threads=4 -ofps 29.970 -o mencoder.264 ./vob/*.vob
mkfifo video.fifo.y4m
transcode -i ./vob/ -o video.fifo.y4m -x vob -y yuv4mpeg,null
x264 --crf 23 --trellis 1 --ref 3 --bframes 5 --b-pyramid --weightb --mixed-refs --analyse all --8x8dct --threads 4 --fps 29.970 -o x264-cli.264 video.fifo.y4m 720x480
with these two commands, given the same ~140 second chunk of video (anime content in case it might matter), i got the following results
mencoder.264 15M
x264-cli.264 20M
As one might expect, this left me mightily confused, i opened both results in vim to read the options, and the only differences were in analyse, 8x8dct (causes mencoder to crash for some reason) and deadzone. So, I continued testing trying to get things in sync, but nothing would close the gap, so finally i tried the following mencoder line to see what would happen.
mencoder -nosound -aspect 4:3 -of rawvideo -ovc x264 -x264encopts crf=23:trellis=1:frameref=3:bframes=5:b_adapt:b_pyramid:weight_b:mixed_refs:4x4mv:subq=6:threads=4 -ofps 29.970 -o mencoder2.264 ./vob/*.vob
mencoder2.264 20M
note that the only difference is the removal of the yadif deinterlacing filter. At that point I assumed perhaps there was a problem in the compression for interlaced content, and so tried transcode with the tomsmocomp deinterlacer as in the following.
mkfifo video.fifo.y4m
transcode -j tomsmocomp -i ./vob/ -o video.fifo.y4m -x vob -y yuv4mpeg,null
x264 --crf 23 --trellis 1 --ref 3 --bframes 5 --b-pyramid --weightb --mixed-refs --analyse all --8x8dct --threads 4 --fps 29.970 -o x264-cli2.264 video.fifo.y4m 720x480
x264-cli2.264 20M
So, at this point I'm wondering if there's some variable I have failed to consider, or if yadif has some kind of particular worth as a pre-encode filter for x264, has anyone had similar experiences?
The raw chunk used in these tests is 137M in vob form, if anyone is sufficiently interested i can post the chunk, but i imagine the results will hold at least for any given animated content. Please tell me what your thoughts are because I am still... perplexed.
Also, if anybody is aware of another script or program designed to handle episodic content i would like to know of it (automatically batch encoding along episode boundaries and so forth and so on), and on a side note, can anyone recommend a custom matrix for mid-quality animated content?