dinsdag 11 januari 2011

#08 | avidemux

New phone, avec possibilities to play video (HTC Hero). No divx or xvid support though, so we need to do some converting using avidemux. On Ubuntu:

#sudo apt-get install avidemux-qt

to install avidemux-qt. This seems to be the only version that actually works. Avidemux comes with some great powers. I've adjusted a script to easily convert my movies so that they can be played on a HTC Hero: video: MPEG-4 ASP (avcodec), Quantisation type: H.263, Resize filter width=480px. audio: AAC (Faac), 128kbps.

#cat script.js
var app = new Avidemux();

origx = app.video.width;
origy = app.video.height;

// calculate new y-value, assuming video is wide-screen (x > y)
x = 480;
y = (origy / (origx/x));

// resize filter
app.video.addFilter("mpresize","w=" + x,"h=" + y,"algo=0");

// video codec
app.video.codecPlugin("0E7C20E3-FF92-4bb2-A9A9-55B7F713C45A", "avcodec", "CQ=4", "<?xml version='1.0'?><Mpeg4aspConfig><presetConfiguration><name></name><type>default</type></presetConfiguration><Mpeg4aspOptions><motionEstimationMethod>epzs</motionEstimationMethod><fourMotionVector>true</fourMotionVector><maximumBFrames>0</maximumBFrames><quarterPixel>false</quarterPixel><globalMotionCompensation>false</globalMotionCompensation><quantisationType>h263</quantisationType><macroblockDecisionMode>rateDistortion</macroblockDecisionMode><minimumQuantiser>2</minimumQuantiser><maximumQuantiser>31</maximumQuantiser><quantiserDifference>3</quantiserDifference><trellis>false</trellis><quantiserCompression>0.5</quantiserCompression><quantiserBlur>0.5</quantiserBlur></Mpeg4aspOptions></Mpeg4aspConfig>");

// audio
app.audio.reset();
app.audio.codec("Faac",128,4,"80 00 00 00 ");
app.audio.normalizeMode=0;
app.audio.normalizeValue=0;
app.audio.delay=0;
app.audio.mixer="NONE";
app.setContainer("MP4");
setSuccess(1);

This script could be placed in the ~/.avidemux/custom/ directory. It should be visible then in the custom menu of avidemux. I prefer to batch my videos though:

#cat batch.sh
#!/bin/bash
VAR="files.txt"
ls *.mkv | sort > $VAR
cat $VAR | while read line; do
  INPUT=$(echo ${line})
  OUTPUT=${INPUT%.mkv}
  OUTPUT+=".mp4"
  avidemux2_qt4 --nogui --load "$INPUT" --run ~/.avidemux/custom/script.js --save "$OUTPUT" --quit
done
rm $VAR

Above script searches for all .mkv files within the current directory and converts them to a .mp4 file using the custom script provided above. Make sure to chmod +x it and run it with ./ instead of sh.

note: I am experiencing stuttering on some of the videos that I converted. Not sure why.

Geen opmerkingen: