Ubuntu Buzz! already has written a post about 10 Useful FFmpeg command that should be known. Today, I'd like to share more useful FFmpeg commands especially for screencasting. Happy reading :)
Installing required packages:
Screencasting
- sudo apt-get install ubuntu-restricted-extras ffmpeg x264 frei0r-plugins mjpegtools
To begin screencasting on your screen, simply run the following command:
The above command will record the area spotted by the mouse cursor. Press CTRL + C to stop recording and save your work. If you want to set resolution of the video, use the following command:
- ffmpeg -f x11grab -follow_mouse 100 -r 25 -s vga -i :0.0 filename.avi
Want to create HD Video? Run this command:
- ffmpeg -f x11grab -s 800x600 -r 25 -i :0.0 -qscale 5 filename.avi
- ffmpeg -f x11grab -s 800x600 -r 25 -i :0.0 -qscale 5 filename.avi
Adding sound to picture
Well, if you just want to make a video from your picture and additionally add any sound in it, simply run the following command:
Adding watermark
- ffmpeg -i audio.mp3 -loop_input -f image2 -i file.jpg -t 188 output.mp4
After recording your video, you might want to add some watermarks in it. Well, run this command to do so:
Picture watermark:
The above command will ad picture watermark on the top left corner of the video. The "overlay=10:10[out]" parameter indicates top left corner, below are more parameters you can use:
- ffmpeg -i input.avi -vf "movie=file.png [watermark]; [in][watermark] overlay=10:10 [out]" output.flv
- Top right corner: "overlay=main_w-overlay_w-10:10 [out]"
- Bottom left corner: "overlay=10:main_h-overlay_h-10 [out]"
- Bottom right corner: "overlay=main_w-overlay_w-10:main_h-overlay_h-10 [out]"
The command is:
via: UpUbuntu.com
- ffmpeg -i input.mp4 -vf drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSans.ttf: text='YOUR TEXT HERE':fontcolor=red@1.0:fontsize=70:x=00: y=40" -y output.mp4