Useful commands for multimedia and graphics using CLI
hi all,
I want to start a thread of commands related to multimedia and graphics such as playing, viewing, editing, encoding and such preferably from the command line. Hopefully, our commands can be useful to others and me. Rip a DVD title Code:
HandBrakeCLI -i /media/MOVIE_TITLE/VIDEO_TS/ -t <num> -o movie-name.mp4 Code:
HandBrakeCLI -i input_file --start-at duration:300 --stop-at duration:180 -o out.mp4 So, if you have any favorites using mplayer/mencoder, ffmpeg/avconv, sox, convert, HandBrakeCLI or whatever, let us know. |
Here is a command that I used early on for my podcast for encoding videos using mencoder.
mencoder [options] file1 [specific options] [file2] [specific options] This takes a file named 'out.ogv' created with gtk-recordmydesktop, and re-encodes it as 'out.avi' adds a title, artist, genre, copyright and comment. Code:
mencoder out.ogv -oac mp3lame -ovc lavc -ofps 30 -vf scale=1024:768 -o out.avi -info name="Going Linux Screencast #001":artist="Larry Bushey and Tom Chaudoir":genre="screencast":subject="Using Audacity to Record a Podcast":copyright="Creative Commons License Attribution 3.0":comment="screencasts.goinglinux.com" http://ubuntuforums.org/showthread.php?t=806125 |
For graphics, ImageMagic is awesome.
http://www.imagemagick.org/script/index.php |
I use this to record my screen in Ubuntu 13.04 with audio from my Logitech webcam:
Code:
ffmpeg -f alsa -i plughw:CARD=U0x46d0x809,DEV=0 -acodec flac -f x11grab -r 30 -s 1214x776 -i :0.0 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 -sameq capture.avi |
Use your own device nodes, and file names.
Dump audio from video into .mp3 format Code:
ffmpeg -i file.avi -vn -c:a libmp3lame -b:a 128k Output.mp3 Code:
ffmpeg -f alsa -i hw:1,1 -c:a copy -vn out.wav Code:
ffmpeg -f alsa -i hw:1,1 -f x11grab -r 24 -s 320x240 -i :0.0 -c:a libmp3lame -b:a 32k -c:v libx264 -b:v 500k output.avi Code:
arecord -vv -fdat out.wav Code:
ffmpeg -f alsa -i hw:0,0 -c:a copy -vn out.wav Code:
ffmpeg -i file.vob -map 0:0 -map 0:2 ...Out.avi Code:
ffmpeg -i file.vob -async 1 -vsync 0-3... Code:
ffmpeg -i file.vob -vol 256... Top left corner Code:
ffmpeg –i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=10:10 [out]" outputvideo.flv Code:
ffmpeg –i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]" outputvideo.flv Code:
ffmpeg –i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=10:main_h-overlay_h-10 [out]" outputvideo.flv Code:
ffmpeg –i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:main_h-overlay_h-10 [out]" outputvideo.flv Code:
ffmpeg -i "concat:/path/to/file1.mp3|/path/to/file2.mp3" -c:a copy -vn Output.mp3 Code:
ffmpeg -i file.vob -copyts -vsync 2.... Code:
ffplay -vf mp=eq2=1.0:1.0:0.1:1.0 file.avi Code:
ffmpeg -i input.mp3 -filter:a "atempo=1.5" -vn ...output.mp3 Code:
sox file.mp3 fixed.mp3 speed 1.2 Code:
ffmpeg -i input.flv -r 40 -filter:v 'setpts=0.750*PTS' -an .....output.flv Code:
ffmpeg -f v4l2 -s 200x150 -i /dev/video0 -c:v libx264 -b:v 300k out.avi Code:
ffmpeg -i vid.ts -bsf:a aac_adtstoasc -c:a copy .....out.avi Code:
mplayer file.flv -ss 00:05 -endpos 6 -vo gif89a:fps=5:output=output.gif -vf scale=400:300 -nosound Code:
mplayer file.mp3 -af scaletempo -speed 1.5 Code:
mplayer file.mp3 -af scaletempo=scale=1.0:speed=pitch Code:
mplayer dvb:// Code:
mplayer dvb://WNBC -dumpstream -dumpfile out.ts Code:
azap -r -c ~/.mplayer/channels.conf WNBC Code:
cat /dev/dvb/adapter0/dvr0 > out.ts Code:
mencoder file.flv -ovc copy -oac copy -of rawaudio -o test.mp3 Code:
mencoder -audiofile /path/to/input.wav -demuxer rawvideo -rawvideo w=1:h=1 /path/to/input.wav -ovc copy -oac mp3lame -lameopts cbr:br=192 -of rawaudio -o output.mp3 footnote Create or modify ~/.asoundrc with Code:
pcm.!default { Code:
modprobe snd-aloop |
I have a tip for scaling videos higher or lower i.e resizing.
Ffmpeg For ffmpeg, the -s is still compatible with ffmpeg. However, for example, you can also use -vf scale=640:480 to resize the video. Yes, it's more typing but the neat tip is below. Have you ever wanted to resize a video to an unusual resolution and you don't want to guess the values, give -vf scale a starting number and it will fill the rest, thus keeping proper aspect ratio of the encoded video. In this example, 500 is the starting value of the resolution I want, the -1 will fill the second value for me. And the video will be in proper aspect ratio. -vf scale=500:-1 As the video is being encoding, it will show the values it chosen. **Note: Don't use -vf scale on live screen captures especially when capturing the full screen of your desktop. You can, however, use -vf scale after doing the screen capture to resize the video higher or lower. Mencoder mencoder uses the same -vf scale option as well. The only difference is it uses a -2 -vf scale=500:-2 Happy encoding. |
All times are GMT -5. The time now is 11:30 PM. |