Pejman Moghadam / Slackware

Slackware 12.2 - Using MultiMedia from command line

Public domain


ALSA

chmod +x /etc/rc.d/rc.alsa
alsamixer
alsactl store
/etc/rc.d/rc.alsa restart

MPlayer

cd /usr/src
wget http://www4.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc2.tar.bz2
tar -jxf MPlayer-1.0rc2.tar.bz2
cd MPlayer-1.0rc2
./configure --prefix=/usr/local/mplayer --enable-gui
make
make install

MPlayer codecs

cd /usr/src
wget http://www4.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2
tar -jxf essential-20071007.tar.bz2
mkdir -p /usr/local/lib/codecs
cp -rv essential-20071007/* /usr/local/lib/codecs/

Subtitles

mplayer -fs -zoom -framedrop -subwidth 90 -sub Movie.srt Movie.avi

Audio stream recording

mplayer -dumpstream -vc dummy -vo null -dumpfile ${FILE}.rm ${URL}

Video stream recording

mplayer -dumpstream -dumpfile ${FILE}.wmv ${URL}

Converting .rm to .wav

for f in *.rm; do
mplayer \
  -quiet \
  -vo null \
  -vc dummy \
  -ao pcm:waveheader:file="$f.wav" "$f"
done

Converting .wav to .mp3

To convert MP3 files with a WAV header add --mp3input switch to lame command.

for f in *.wav; do
  lame -V0 -h -b 160 --vbr-new "$f" "$f.mp3"
done

find . -iname "*.wav" -exec lame -q0 -V0 -h -b 320 --ns-bass -8 --ns-alto -8 --ns-treble -5 --ns-sfb21 5 --lowpass 16.7 --vbr-new {} {}.mp3 \;

ffmpeg -i audio.wav -ab 320k output.mp3

Watching VCD

mplayer -zoom -fs vcd://2

ripping VCD

vcdxrip -pvC /dev/hdb

ripping Audio CD

cdparanoia -Q
cdparanoia -B

-Q query and print the CDROM table of contents.
-B split the output into multiple files at track boundaries.


Using mencoder

http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-vcd-dvd.html


Converting any video to PAL-DVD mpg

mencoder -oac lavc \
         -ovc lavc \
         -of mpeg \
         -mpegopts format=dvd:tsaf \
         -vf scale=720:576,harddup \
         -srate 48000 \
         -af lavcresample=48000 \
         -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=15:vstrict=0:acodec=ac3:abitrate=192:aspect=16/9 \
         -ofps 25 \
         -o movie.mpg movie.avi

Converting any video to PAL-VCD mpg

mencoder -oac lavc \
         -ovc lavc \
         -of mpeg \
         -mpegopts format=xvcd \
         -vf scale=352:240,harddup \
         -srate 44100 \
         -af lavcresample=44100 \
         -lavcopts vcodec=mpeg1video:keyint=18:vrc_buf_size=327:vrc_minrate=1152:vbitrate=1152:vrc_maxrate=1152:acodec=mp2:abitrate=224 \
         -ofps 30000/1001 \
         -sub movie.srt -o movie.mpg movie.avi

Converting any video to NTSC-VCD mpg

mencoder -oac lavc \
         -ovc lavc \
         -of mpeg \
         -mpegopts format=xvcd \
         -vf scale=352:240,harddup \
         -srate 44100 \
         -af lavcresample=44100 \
         -lavcopts vcodec=mpeg1video:keyint=18:vrc_buf_size=327:vrc_minrate=1152:vbitrate=1152:vrc_maxrate=1152:acodec=mp2:abitrate=224 \
         -ofps 30000/1001 \
         -sub movie.srt -o movie.mpg movie.avi

Converting wmv to avi

find . -iname "*.wmv" -exec mencoder {} -ofps 23.976 -ovc lavc -oac copy -o {}.avi \;

Fixing an AVI index with mencoder

 mencoder -idx in.avi -ovc copy -oac copy -o out.avi

Join/Split mpg files

mpgtx -j -o all.mpg 1.mpg 2.mpg
mpgtx -2 all.mpg -b prefix

Extracting audio from videos

# MPG -> MP2
mplayer -vo null -dumpaudio video.mpg -dumpfile audio.mp2 video.mpg

# AVI,MP4 -> WAV
mplayer -vo null -ao pcm -ao pcm:file=audio.wav audio.mp4

ffmpeg -i video.mp4 -ab 128000 -ar 44100 audio.mp3

Convert ogg to mp3

for x in *.ogg; do ffmpeg -i "$x" "$(basename "$x" .ogg).mp3"; done

Convert mp3 to ogg

mplayer "${F}" -ao pcm:file=${TMP}.wav
oggenc ${TMP}.wav -q 7 -o "${F}.ogg"

Watching DVD

mplayer dvd://1 -framedrop -fs -zoom -alang en -slang en

Ripping DVD

lsdvd /dev/sr1

mplayer -identify dvd://  -dvd-device /dev/sr1

mplayer dvdnav://5//dev/sr1 -v -dumpstream -dumpfile 5.vob
mplayer dvd://5 -dvd-device /dev/sr1 -v -dumpstream -dumpfile 5.vob

mplayer dvd://2
mplayer dvd://2 -v -dumpstream -dumpfile dump.vob
ffmpeg -i dump.vob -b 1500k -acodec mp2 -ab 128k movie.avi
sudo sh -c 'cat /mnt/cdrom/VIDEO_TS/VTS_05_1.VOB /mnt/cdrom/VIDEO_TS/VTS_05_2.VOB /mnt/cdrom/VIDEO_TS/VTS_05_3.VOB >  dump.vob'

http://idolinux.blogspot.com/2008/09/encode-dvd-to-avi-with-mplayer-on-linux.html


cutmp3

cd /usr/src
wget -c http://www.puchalla-online.de/cutmp3-2.0.1.tar.bz2
tar jxf cutmp3-2.0.1.tar.bz2
cd cutmp3-2.0.1
make && make install

BY: Pejman Moghadam
TAG: alsa, mplayer, mencoder, vcd, audio, dvd, mpg, mp3, wav, avi, flv, cutmp3, multimedia
DATE: 2010-01-17 19:15:36


Pejman Moghadam / Slackware [ TXT ]