Difference between revisions of "Media Conversion"

From Vague Hope Wiki
Jump to: navigation, search
(Audio)
Line 31: Line 31:
 
ffmpeg -i input.flac -ab 196k -ac 2 -ar 48000 output.mp3
 
ffmpeg -i input.flac -ab 196k -ac 2 -ar 48000 output.mp3
 
</pre>
 
</pre>
 +
 +
for a in *.flac; do
 +
  ffmpeg -i "$a" -qscale:a 0 "${a[@]/%flac/mp3}"
 +
done
  
 
split mp3
 
split mp3

Revision as of 03:52, 15 February 2015

Audio

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}"
done

split mp3

sudo aptitude install mp3splt-gtk mp3wrap mp3splt

Video

Tools

General guide: http://ubuntuforums.org/showthread.php?t=786095

mplayer

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) \
 source.mkv

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

ffmpeg

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

handbrake

References

ASCII

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