some useful ffmpeg commands
来源:互联网 发布:camds数据填写 编辑:程序博客网 时间:2024/05/16 07:25
http://www.upubuntu.com/2012/10/some-useful-ffmpeg-commands.html
Some Useful FFMPEG Commands (Screencasting, Rotate Video, Add Logo, etc.) - Ubuntu/Linux Mint
In this tutorial we will see some useful FFMPEG commands that you can use on Ubuntu/Linux Mint to make screencasting videos, rotate videos, add logo/text watermarks to a video, insert shapes, and so on.
To install ffmpeg and some other packages on Ubuntu/Linux Mint, open the terminal and run these commands:
sudo apt-get install ubuntu-restricted-extras
sudo apt-get install ffmpeg x264
sudo apt-get install frei0r-plugins mjpegtools
Note: The file formats used in this tutorial are selected randomly and you can set any other extension of your choice.
1. Screecasting
To record your screen withh FFMPEG, you can use this command:
ffmpeg -f x11grab -follow_mouse 100 -r 25 -s vga -i :0.0 filename.avi
Now the command will record every spot on your screen you hover your mouse cursor over. Press Ctrl+C to stop recording. If you want to set a screen resolution for the video to be recorded, you can use this ffmpeg command:
ffmpeg -f x11grab -s 800x600 -r 25 -i :0.0 -qscale 5 filename.avi
To show the region that will be recorded while moving your mouse pointer, use this command:
ffmpeg -f x11grab -follow_mouse centered -show_region 1 -r 25 -s vga -i :0.0filename.avi
If you want to record in fullscreen with better video quality (HD), you can use this command:
ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq video.mp4
Her is a video example created with the latter command:
2. Add Audio To A Static Picture
If you want to add music to a static picture with ffmpeg, run this command from the terminal:
ffmpeg -i audio.mp3 -loop_input -f image2 -i file.jpg -t 188 output.mp4
To add an image to a video using ffmpeg, you can use one of these commands:
Picture Location: Top Left Corner
ffmpeg -i input.avi -vf "movie=file.png [watermark]; [in][watermark] overlay=10:10 [out]" output.flv
Here is an example:
Picture Location: Top Right Corner
ffmpeg –i input.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]" output.flv
Picture Location: Bottom Left Corner
ffmpeg –i input.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=10:main_h-overlay_h-10 [out]" output.flv
Picture Location: Bottom Right Corner
ffmpeg –i input.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:main_h-overlay_h-10 [out]" output.flv
4. Add Text Watermarks To Videos
To add text to a video, use this command:
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" -youtput.mp4
An example:
To use another text font, you can list them from the terminal with this command:
ls /usr/share/fonts/truetype/freefont/
4. Rotate Videos
To rotate a video 90 degrees with ffmpeg, run this command:
ffmpeg -i input.avi -vf transpose=1 output.avi
Here is an example for a video rotated with ffmpeg:
Here is all parameters:
- 0 = 90 degrees CounterCLockwise (Vertical Flip (default))
- 1 = 90 degrees Clockwise
- 2 = 90 degrees CounterClockwise
- 3 = 90 degrees Clockwise (Vertical Flip)
ffmpeg -i input.avi -vol 100 output.avi
To change volume of an audio file, run this command:
ffmpeg -i input.mp3 -vol 100 -ab 128 output.mp3
6. Insert A Video Inside Another Video
To do this, run this command:
ffmpeg -i video1.mp4 -vf "movie=video2.mp4:seek_point=5, scale=200:-1, setpts=PTS-STARTPTS [movie]; [in] setpts=PTS-STARTPTS, [movie]overlay=270:240 [out]" output.mp4
Here is an example:
7. Add a Rectangle To A Video
To draw for example an orange rectangle in a video, you can use this command:
ffmpeg -i input.avi -vf "drawbox=500:150:600:400:orange@0.9" -sameq -youtput.avi
Video example:
If you have something to add or report a mistake, please use the comment form below.
0 0
- some useful ffmpeg commands
- Some useful linux commands
- some useful Linux commands
- GRUB2 Some Useful Commands
- some useful linux commands
- Some useful Linux Commands
- Some Useful GoldenGate Commands
- Some useful DevOPS commands
- useful-ffmpeg-commands
- Some Useful Commands in Vim
- Some useful commands in cmd
- What are some lesser known but useful Unix commands?
- What are some lesser known but useful Unix commands?
- What are some lesser known but useful Unix commands?
- What are some lesser known but useful Unix commands
- Some Commands
- AIX Useful Commands
- AIX Useful Commands
- 实现智能指针
- Android小程序——乐学成语实现(一)
- 从自定义AlertDialog中获取EditText中的文本解决办法
- const用法详解
- 51nod 1267 4个数和为0
- some useful ffmpeg commands
- hjr教程-C(二):关于指针
- STL 简单 copy 算法的实现
- jQuery选择器使用
- 第十五周程序-补充程序-1
- 构造方法
- 分页查询(二)——用sql与linq查询
- 用x264和ffmpeg将YUV编码为.h264(1)
- 灭点检测算法综述
原创粉丝点击
热门IT博客
热门问题
老师的惩罚
人脸识别
我在镇武司摸鱼那些年
重生之率土为王
我在大康的咸鱼生活
盘龙之生命进化
天生仙种
凡人之先天五行
春回大明朝
姑娘不必设防,我是瞎子
属虎的人适合佩戴什么
属马的人适合佩戴什么
属猴的人适合佩戴什么
隐形眼镜怎样佩戴
隐形眼镜怎么佩戴
双貔貅手链的佩戴方法
度母适合什么人佩戴
蜜蜡不适合什么人佩戴
金曜石哪些人不能佩戴
蜜蜡适合什么人佩戴
黑曜石貔貅手链的佩戴方法
李佩斯
布达佩斯
洛佩斯
超级洛佩斯
佩斯
佩斯塔
罗宾洛佩斯
小猪佩斯
李佩斯出柜
李佩斯图片
李佩斯吧
李佩斯女装
肯佩斯
布达佩斯大饭店
布达佩斯小酒馆
布达佩斯之恋
超级洛佩斯免费高清观看
李佩斯精灵王
佩德罗洛佩斯
佩斯卡拉足球俱乐部
马克西洛佩斯
布达佩斯大饭店影评
超级洛佩斯免费观看
布达佩斯大饭店原型
小猪佩斯中文版
布达佩斯大饭店解析
布鲁克-洛佩斯
佩斯大学研究生费用
李佩斯精灵王回眸动图
佩斯大学研究生