FFmpeg命令创建规则与解析


看了那么多别人写的FFmpeg命令操作,能完成各种各样的编码、解码、录屏、推流、分流、合流等操作,就是一直看别人写,然而当要亲自写一个操作命令的时候,却无法下手,因此还是必须对FFmpeg的命令有一个更清晰的了解,了解如何创建、需要哪些构成、创建规则、一些常用选项等等,总之要熟悉到可以很容易的创建自己需要的命令。

操作命令示例

ffmpeg -f v4l2 -s 1280x720 -i /dev/video0 -f alsa -i hw:1,0 -vcodec libx264 -preset:v ultrafast -tune:v zerolatency -ab 16000 -ar 22050 -ac 1 -f mp3 -f flv rtmp://192.168.1.102:1935/live0
这个命令的作用是
命令的输出信息如下:

ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609
  configuration: --prefix=/usr/local --enable-shared --enable-libx264 --enable-libopencv --enable-gpl
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 688590.974857, bitrate: 110592 kb/s
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x360, 110592 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, alsa, from 'hw:1,0':
  Duration: N/A, start: 1561430261.799069, bitrate: 1024 kb/s
    Stream #1:0: Audio: pcm_s16le, 32000 Hz, stereo, s16, 1024 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
  Stream #1:0 -> #0:1 (pcm_s16le (native) -> adpcm_swf (native))
Press [q] to stop, [?] for help
[video4linux2,v4l2 @ 0x16ae480] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[libx264 @ 0x16d6d40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x16d6d40] profile High 4:2:2, level 3.0, 4:2:2 8-bit
[libx264 @ 0x16d6d40] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html 
- options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 
chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=5 lookahead_threads=5
 sliced_threads=1 slices=5 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 
 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4
 ip_ratio=1.40 aq=0
[alsa @ 0x16b0900] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
Output #0, flv, to 'rtmp://192.168.1.102:1935/live0':
  Metadata:
    encoder         : Lavf58.12.100
    Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv422p(progressive), 640x360, q=-1--1, 30 fps, 1k tbn, 30 tbc
    Metadata:
      encoder         : Lavc58.18.100 libx264
    Side data:
      cpb: bitrate max/min/avg
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值