【libav】libav的常用方法
来源:互联网 发布:java递归查询父节点 编辑:程序博客网 时间:2024/06/05 10:35
https://wiki.libav.org/Snippets/avconv
avconv
Thanks to roxlu for providing most of them.
Convert from raw x264 to flv (when you get an error with monotonically increasing dts)
avconv -i test_input.264 -c:v copy output.flv
Convert from flv to mov and specify bitrate
avconv -i test_input.flv -b 512k output.mov
Extract audio from movie
avconv -i test_input.mp4 -c:a copy -vn -y out.aac
Export only video from movie
avconv -i input.mov -an -c:v copy out.mov
Combine audio and video file
avconv -i video_input.mov -i audio_input.mp3 -c copy audio_and_video.mov
Create video from image sequence
avconv -framerate 25 -f image2 -i image-%03d.jpeg -b 65536k out.mov
Create video from image sequence (really good quality)
avconv -framerate 25 -f image2 -i %04d.png -c:v h264 -crf 1 out.mov
Extract one second from a video
avconv -ss 00:00:00 -i scanner.mov -t 00:00:01 -c:v copy scanner_small.mov
Read raw RGB frames from tcp and convert them into a video
avconv -v debug -f rawvideo -pix_fmt rgb24 -s 320x240 -i tcp://localhost:2233 -c:v h264 result.mov
Add audio to a video file and make sure the shortest stream is used, also show some debug info
avconv -v debug -i audio.wav -i video.mp4 -c:a libmp3lame -qscale 20 -shortest output.mov
Combining image sequences
Combining image sequences which are spread over multiple directories
On unix-like systems
cat dir_a/*.jpg dir_b/*.jpg dir_c/*.jpg | ./avconv -f image2pipe -c:v mjpeg -i - -r 25 -map 0 out.mov
On windows, note the slashes
type dir_a\\*.jpg dir_b\\*.jpg dir_c\\*.jpg | avconv.exe -f image2pipe -c:v mjpeg -i - -r 25 -map 0 out.mov
Set a quality scale, use the shortest stream (audio of video)
cat dir_a/*.jpg dir_b/*.jpg dir_c/*.jpg ./avconv | ./avconv -f image2pipe -c:v mjpeg -i - -i audio.mp3 -c:a libmp3lame -qscale 20 -shortest -r 25 -map 0 -map 1 out.mov
Exporting frames from a video
Exporting to jpeg images
The qscale is the jpeg quality, 1 = excellent, 31 = worst
avconv -i intro.mov -vsync 1 -r 25 -an -y -qscale 1 out_%04d.jpg
Resizing the output on the fly.
avconv -i intro.mov -vsync 1 -r 25 -an -y -qscale 1 -s 1280x720 out_%04d.jpg
Exporting to raw YUV
avconv -v debug -f rawvideo -pix_fmt yuv420p -s 320x240 -i raw.yuv -r 1 -vcodec h264 out.mov
Produce a 10s test video
avconv -y -filter_complex testsrc -t 10s out.avi
Streaming
Test akamai CDN using synthetic video
avconv -filter_complex text testsrc=hd720 -c:v h264 -b:v 500k -f flv rtmp://<USERNAME>:<PASSWORD>@p.<CPCODE>.i.akamaientrypoint.net/EntryPoint/mystream_1_500@<STREAMID>
Streaming pcm audio
Never use the wav container if you plan to stream indefinitely. arecord is provided as example, the alsa or pulsebuiltin capture should work better.
arecord -Dplughw:0,0 -f S16_LE -t raw -r 44100 -c 2 -N - | /usr/bin/avconv -f s16le -ar 44100 -ac 2 -i - -c:a libfdk_aac -b:a 80k -f mpegts udp://localhost:5000
Restream multicast mpegts to rtmp
Select a specific PID from a multicast mpegts stream and re-encode it before reflecting to an rtmp server
avconv -f mpegts -i udp://host:port -c:a:i:2300 aac -b:a 384k -c:v copy -f flv rtmp://host/live/stream
Interlace a progressive content
Creating new interlaced content is a bad idea in general terms, do that only if you need to feed content to legacy equipment that does not have a progressive mode. 720p50 is always better than 1080i25 and it uses the same bandwidth.
avconv -i INPUT -vf interlace -flags +ildct+ilme OUTPUT
Use avfilter
Use frei0r's bluescreen0r-filter
Make a certain color transparent, for example for webcam chroma key'ing
avconv -i overlay_source -i background_source -filter_complex 'frei0r=bluescreen0r:0/0/255|128,[1:v]overlay=0:0' output_destination
0/0/255|128 are the bluescreen0r-parameters, first color, then the tolerance. The format is blue/green/red|tolerance. The components of the color being alpha'ed out is specificed between 0-255, and the tolerance adjusts how wide a range around the specified color is to be adjusted.
bluescreen0r will ignore all existing alpha-components in the source and completely replace them.
- 【libav】libav的常用方法
- 编译libav(ffmpeg)库
- libav 切割视频
- ffmpeg/libav 选择
- gst-libav配置
- libav probe问题
- 解决ffmpeg/libav 编译后ffplay没有生成的问题
- Using lcov With FFmpeg/Libav
- 我为avPlayer社区写的一个libav的中文api
- 读取笔记本的摄像头的原始yuv数据,通过libav(ffmpeg编码)
- 读取笔记本的摄像头的原始yuv数据,通过libav(ffmpeg编码)
- libav-9.1(ffmpeg)交叉编译
- 原来是x264需要libav库啊。
- [Linux]Libav在Ubuntu下编译备忘
- libav(ffmpeg)简明教程(1)
- libav(ffmpeg)简明教程(2)
- 【整理】Libav、FFmpeg、mplayer、VLC开源项目、FFDshow
- library.mak:92: *** missing separator. Stop libav 编译出错
- Java Object
- 2016.3.25
- python2.7:urllib 和urllib2之间的区别
- J2EE领域的一些技术框架结构图
- ./configure,make,make install的作用
- 【libav】libav的常用方法
- C++在继承中虚函数、纯虚函数、普通函数详解
- 百度地图(精华版)
- 【Tyvj1783】【codevs2418】【BZOJ1856】字符串,厉害的组合数与模型转换
- 2016SDAU课程练习一1013 Problem N
- c++上机报告2
- ios 企业版ipa 服务器发布
- 10.List集合去重
- Swift 与OC之桥接文件