Media Conversion

From Vague Hope Wiki
Revision as of 03:22, 25 October 2015 by Haku (Talk | contribs) (Audio)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


aac to wav

$ mplayer -ao pcm a.aac -ao pcm:file="a.wav"

aac to m4a

$ MP4box -add a.aac -new a.m4a

wav to mp3, mono, 192

lame -h a.wav a.mp3
lame -h -m m a.wav a.mp3
lame -h -b 192 a.wav a.mp3

fixing and info

mpg123 --rate 44100 --stereo --resync a.mp3
vbrfix a.mp3
exiftool a.mp3

extract audio from video

ffmpeg -i inputfile.flv -acodec copy output.mp3

GUI tool: soundconverter

flac to mp3

ffmpeg -i input.flac -ab 196k -ac 2 -ar 48000 output.mp3
for a in *.flac; do
  ffmpeg -i "$a" -qscale:a 0 "${a[@]/%flac/mp3}"

split mp3

sudo aptitude install mp3splt-gtk mp3wrap mp3splt

join mp3s:

ffmpeg -i "concat:file1.mp3|file2.mp3" -acodec copy output.mp3
ffmpeg -i "concat:$(join '|' *.mp3)" -acodec copy "output.mp3"



General guide:


Transcode for Transformer. Burns in ass subs.

  • mplayer from source.
  • x264 from source.
  • neroAacEnc binary (see 4th source),
  • Ubuntu repo MP4Box.
  • Need to manually supply $FRAME_RATE.
mplayer -benchmark -ass \
 -vo yuv4mpeg:file=>(x264 --demuxer y4m --crf 22 \
  --preset slow --profile main --level 3.1 \
  --vbv-bufsize 14000 --vbv-maxrate 14000 \
  --threads 2 --output video.264 - 2>x264.log) \
 -ao pcm:fast:file=>(neroAacEnc \
  -ignorelength -lc -q 0.6 -if - -of audio.mp4 2>nero.log) \

MP4Box -fps $FRAME_RATE -add video.264 -add audio.mp4 final.mp4

Possible FPS detection:

FPS=$($MPLAYER -vo null -ao null -frames 0 \
 -identify "$SOURCE" 2>/dev/null \
 | sed -ne '/^ID_/ { s/[]()|&;<>`'"'"'\\!$" []/\\&/g;p }' \
 | grep 'VIDEO_FPS' \
 | cut -d '=' -f 2)

mplayer filters

Detect black box border:

mplayer [source] -chapter 3 -vf cropdetect

Select audio and disable subs:

mplayer [source] -alang ja -nosub -noautosub -forcedsubsonly -sid 1000


Down-scale mp4:

ffmpeg -i source.mp4 -vcodec libx264 -vprofile main -preset slow -b:v 400k -maxrate 400k -bufsize 800k -vf scale=852:480 -threads 0 -acodec libfaac -ab 128k output.mp4

Note: can do 'scale=-1:480' to calculate width.

Lossless Trimming

$FFMPEG -ss 0 -t 00:04:13 -i in.mp4 -acodec copy -vcodec copy out.mp4




xterm -fn 5x7 -geometry 250x80 -e "setterm -cursor off ; mplayer -quiet -vo aa:driver=curses -monitorpixelaspect 0.5 test.avi"