Difference between revisions of "Media Conversion"

From Vague Hope Wiki
Jump to: navigation, search
Line 71: Line 71:
 
  | grep 'VIDEO_FPS' \
 
  | grep 'VIDEO_FPS' \
 
  | cut -d '=' -f 2)
 
  | cut -d '=' -f 2)
 +
</pre>
 +
 +
=== mplayer filters ===
 +
 +
Detect black box border:
 +
<pre>
 +
mplayer [source] -chapter 3 -vf cropdetect
 +
</pre>
 +
 +
Select audio and disable subs:
 +
<pre>
 +
mplayer [source] -alang ja -nosub -noautosub -forcedsubsonly -sid 1000
 
</pre>
 
</pre>
  
Line 87: Line 99:
 
* http://virishi.net/useful-video-transcoding-commands
 
* http://virishi.net/useful-video-transcoding-commands
 
* https://sites.google.com/site/linuxencoding/x264-encoding-guide
 
* https://sites.google.com/site/linuxencoding/x264-encoding-guide
 +
* http://www.mplayerhq.hu/DOCS/HTML/en/faq.html
 +
* http://www.axllent.org/docs/video/mencoder_dvd_to_mpeg4
  
 
== ASCII ==
 
== ASCII ==

Revision as of 14:58, 4 December 2012

Audio

aac to wav

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

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

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.

References

ASCII

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