Command cookboook
Contents
Making PDF from manual[edit]
Handy for the big Mplayer manual
man -t mplayer | ps2pdf - > mplayer.pdf
Source(s): Command cookboook
Make a playlist using find[edit]
find . -iname "*.mp3" > playlist.txt
Source(s): Command cookboook
Shuffle play clips from folder[edit]
peter@laptop:~/Video$ mplayer -shuffle Video/*
Or: read a playlist using the shuffle option:
peter@laptop:~/Music$ mplayer -playlist playlist.txt -shuffle
or shuffle the playlist in a shuffled playlist:
with command shuf:
peter@laptop:~/Music$ shuf playlist.txt > playlist
Source(s): Command cookboook
playing small part of clip[edit]
mplayer -ss 10 -endpos 10 Antichrist.2009.DVDRIP.XviD-ZEKTORM/Antichrist.2009.DVDRIP.XviD-ZEKTORM.avi
extracting small part of clip[edit]
mencoder -ss 00:10:00 -endpos 00:00:10 Antichrist.2009.DVDRIP.XviD-ZEKTORM/Antichrist.2009.DVDRIP.XviD-ZEKTORM.avi -oac pcm -ovc lavc -lavcopts vcodec=mpeg4 -o test.avi
Glueing different files together with a whild card[edit]
mencoder *.avi -oac pcm -ovc lavc -lavcopts vcodec=mpeg4 -o testglue.avi
Scripts to extract[edit]
to extract small fragments from a long film, and then paste them together to testglue.avi, and then play the file fullscreen
#!/bin/bash for ((i=1; i<10; i+=1)) do mencoder -ss 00:${i}0:00 -endpos 2 Antichrist.2009.DVDRIP.XviD-ZEKTORM/Antichrist.2009.DVDRIP.XviD-ZEKTORM.avi -oac pcm -ovc lavc -lavcopts vcodec=mpeg4 -o test00$i.avi done mencoder test0*.avi -oac pcm -ovc lavc -lavcopts vcodec=mpeg4 -o testglue.avi mplayer -fs testglue.avi
Or with 99 clips of 0.25 seconds
#!/bin/bash rm test0* for ((i=1; i<100; i+=1)) do mencoder -ss 00:`printf "%02d" $i`:00 -endpos 0.25 Antichrist.2009.DVDRIP.XviD-ZEKTORM/Antichrist.2009.DVDRIP.XviD-ZEKTORM.avi -oac pcm -ovc lavc -lavcopts vcodec=mpeg4 -o test`printf "%04d" $i`.avi 2> /dev/null > /dev/null done mencoder test0*.avi -oac pcm -ovc lavc -lavcopts vcodec=mpeg4 -o testglue.avi 2> /dev/null > /dev/null mplayer -fs testglue.avi
Making Motion-JPEG (mjpeg)[edit]
If you use the command:
ffmpeg -i my-movie.mov my-movie.mjpeg
This creates a file with each frame encoded as JPEG. However, this file may not be usable, because it doesn't have a proper container format.
Making a MJPEG AVI[edit]
You could better explicitly choose a container format, like AVI:
ffmpeg -i my-movie.mov -vcodec mjpeg -f avi my-movie.avi
or simply (ffmpeg recognizes the -f option from the extension of the output file)
ffmpeg -i my-movie.mov -vcodec mjpeg my-movie.avi
Making a MJPEG QuickTime[edit]
ffmpeg -i my-movie.mov -vcodec mjpeg -f mov my-movie.mov
or simply:
ffmpeg -i my-movie.mov -vcodec mjpeg my-movie.mov
Useful GStreamer "1-liners"[edit]
NB: gstreamer pipelines are similar to, but not actually commandline pipelines. In a gstreamer pipeline, the "pipe" character is an exclamation mark (!) and not a true pipe (|)
Look at a web cam
gst-launch-0.10 v4l2src device=/dev/video0 ! ffmpegcolorspace ! xvimagesink
doesn't work?, try v4lsrc instead of v4l2src.
gst-launch-0.10 v4l2src device=/dev/video0 ! video/x-raw-yuv,width=320,height=240 ! xvimagesink
Take a picture with your webcam:
gst-launch-0.10 v4l2src ! ffmpegcolorspace ! pngenc ! filesink location=foo.png
- GStreamer Website
- GStreamer on OLPC Wiki
- barcamp presentation with cool examples
Streaming video[edit]
in case VLC, Theorur, Streamnow, or whatever ... does not satisfy your streaming desires, here's a line that might work. No sound.
ffmpeg2theora /dev/video1 -f video4linux2 -o /dev/stdout | oggfwd experimentaltv.org 8000 password test.ogg