免费高清特黄a大片,九一h片在线免费看,a免费国产一级特黄aa大,国产精品国产主播在线观看,成人精品一区久久久久,一级特黄aa大片,俄罗斯无遮挡一级毛片

分享

FFmpeg最常用命令參數(shù)詳解及應(yīng)用實(shí)例

 開(kāi)花結(jié)果 2024-03-27 發(fā)布于北京

原文鏈接:https://blog.csdn.net/suny2020/article/details/129299839

ffmpeg命令行參數(shù)解釋

ffmpeg -i [輸入文件名] [參數(shù)選項(xiàng)] -f [格式] [輸出文件]

ffmpeg [[ options ][ -i input_file ]]... {[ options ] output_file}...

參數(shù)選項(xiàng):

(1) -an: 去掉音頻 -vn:去掉視頻 -t:持續(xù)時(shí)長(zhǎng) -ss:起始時(shí)間 -r:幀率(默認(rèn)為25) -s:幀大?。╓*H) -aspect:橫縱比(4:3,16:9等)

(2) -acodec: 音頻選項(xiàng), 一般后面加copy表示拷貝

(3) -vcodec:視頻選項(xiàng),一般后面加copy表示拷貝

格式選項(xiàng):

(1) h264: 表示輸出的是h264的視頻裸流

(2) mp4: 表示輸出的是mp4的視頻

(3) mpegts: 表示ts視頻流

ffmpeg命令格式轉(zhuǎn)換

視頻格式轉(zhuǎn)換:

ffmpeg -i test.h264 -vcodec copy -f mpegts test.ts              # 將h264格式轉(zhuǎn)為ts格式

ffmpeg -i test.h264 -vcodec copy -f mp4 test.mp4              # 將h264格式轉(zhuǎn)為MP4格式

視頻拼接: 

ffmpeg -i "concat:test1.h264|test2.h264" -vcodec copy -f h264 out12.h264

# 將test1.h264和test2.h264視頻拼接起來(lái),輸出out12.h264視頻

視頻截圖:

ffmpeg -i test.mp4  -t 0.001 -s 352x240 1.jpg    # 在test.mp4中截圖

ffmpeg -i test.mp4 -vframes 30 -y -f gif 1.gif       # 將test.py前30幀做成gif動(dòng)圖

ffmpeg -i test.mp4 -t 10 -r 1 pic-%03d.jpg           # 從視頻前10s中取圖像,1s提取一幀

常用應(yīng)用例子

#強(qiáng)制顯示寬高

ffplay -i -volume 1 -x 800 -y 480 test_1920x1080.mp4

-framerate 25 :指定幀率

-fs :全屏播放

-an :禁用音頻

-vn :禁用視頻

-sn :禁用字幕

-ss pos :根據(jù)設(shè)置的秒進(jìn)行定位

#在5分 55秒的位置進(jìn)行播放

ffplay -i -volume 1 -x 800 -y 480 -fs test_1280x720.mp4 -ss 00:05:55

-acodec :指定音頻解碼器  -acodec libfdk_aac

-vcodec :指定視頻解碼器  -vcodec h264

-window_title lpf  :指定播放器播放視頻的名稱

-t 指定播放的時(shí)長(zhǎng)

-loop number :循環(huán)播放的次數(shù)

-nostats :不輸出視頻相關(guān)信息,通過(guò)這個(gè)可以查看ffplay 如何收集的這些信息,自己寫(xiě)播放器可以借鑒

-ast :執(zhí)行音頻流索引

-vst :執(zhí)行視頻流索引,這個(gè)只有在視頻包含多個(gè)流才會(huì)生效

#下面這個(gè)是執(zhí)行視頻流索引是4  音頻索引是3

ffplay -i  -x 800 -y 480  mult.ts -vst 4 -ast 3

-autoexit :播放完畢自動(dòng)退出

#指定播放時(shí)間是5秒  播放完畢自動(dòng)退出

ffplay -i  -x 800 -y 480  mult.ts -t 5 -autoexit

#通過(guò)-codec:v h264 指定使用特定的解碼器進(jìn)行解碼播放 

ffplay -i test_1280x720.mp4 -x 800 -y 480  -t 5 -autoexit -codec:v h264

#通過(guò)-codec:a 指定使用libfdk_aac 來(lái)解碼音頻數(shù)據(jù)

ffplay -i test_1280x720.mp4 -x 800 -y 480  -t 5 -autoexit -codec:a libfdk_aac

播放rtmp流媒體:

#播放rtmp 流媒體

ffplay -window_title "cctv1" -x 640 -y 480 rtmp://media3.scctv.net/live/scctv_800

#播放yuv 裸視頻  必須指定寬高以及視頻格式  幀率指定不指定都行

ffplay -pixel_format yuv420p -video_size 320x240 -framerate 5 yuv420p_320x240.yuv

#播放rgb

ffplay -pixel_format rgb24 -video_size 320x240 -i rgb24_320x240.rgb

#播放pcm  -ar 執(zhí)行采樣率  -ac指定通道數(shù)  -f 指定位深

ffplay -ar 48000 -ac 2 -f f32le 48000_2_f32le.pcm

ffplay 簡(jiǎn)單的過(guò)濾器:

#ffplay 簡(jiǎn)單的過(guò)濾器

#視頻旋轉(zhuǎn)

ffplay -i test.mp4 -vf transpose=1

ffplay -i test_1280x720.mp4 -x 800 -y 480  -t 25 -autoexit -codec:a libfdk_aac  -window_title lpf -vf transpose=1

#視頻反轉(zhuǎn)

ffplay test.mp4 -vf hflip

ffplay test.mp4 -vf vflip

ffplay -i test_1280x720.mp4 -x 800 -y 480  -t 25 -autoexit -codec:a libfdk_aac  -window_title lpf -vf vflip

#旋轉(zhuǎn)和反轉(zhuǎn)

ffplay test.mp4 -vf hflip,transpose=1

#音頻變速播放

ffplay -i test.mp4 -af atempo=2

ffplay -i test_1280x720.mp4 -x 800 -y 480  -t 25 -autoexit -codec:a libfdk_aac  -window_title lpf -af atempo=2

#視頻變速播放

ffplay -i test.mp4 -vf setpts=PTS/2

#音頻和視頻同時(shí)變速

ffplay -i test_1280x720.mp4 -x 800 -y 480  -t 25 -autoexit -codec:a libfdk_aac  -window_title lpf -af atempo=2 -vf setpts=PTS/2

#-i 表示輸入  -codec copy 不重新進(jìn)行編碼  -ss 起始時(shí)間  -t 指定時(shí)長(zhǎng)  -f 指定輸出格式

ffplay -i test_1280x720.mp4 -codec copy -ss 10 -t 20 -f flv out.mp4

ffmpeg 參數(shù)說(shuō)明: 

#ffmpeg 參數(shù)說(shuō)明

-i 設(shè)定輸入流

-f 設(shè)定輸出格式(format)

-ss 開(kāi)始時(shí)間

-t 時(shí)間長(zhǎng)度

-aframes 設(shè)置要輸出的音頻幀數(shù)

-b:a 音頻碼率

-ar 設(shè)定采樣率

-ac 設(shè)定聲音的Channel數(shù)

-acodec 設(shè)定聲音編解碼器,如

果用copy表示原始編解碼數(shù)據(jù)必

須被拷貝。

-an 不處理音頻

-af 音頻過(guò)濾器

ffmpeg -i test_1280x720.mp4 -b:a 192k -ar 48000 -ac 2 -acodec aac -aframes 200 out2.mp3

#視頻

-vframes 設(shè)置要輸出的視頻幀數(shù)

-b 設(shè)定視頻碼率

-b:v 視頻碼率

-r 設(shè)定幀速率

-s 設(shè)定畫(huà)面的寬與高

-vn 不處理視頻

-aspect aspect 設(shè)置橫縱比 4:3 16:9 或 1.3333 1.7777

-vcodec 設(shè)定視頻編解碼器,如果用copy表示原始編解碼數(shù)據(jù)必須被拷貝。

-vf 視頻過(guò)濾器

ffmpeg -i test.mp4 -vframes 300 -b:v 300k -r 30 -s 640x480 -aspect 16:9 -vcodec libx265

#提取音頻數(shù)據(jù)  -acodec copy 直接拷貝音頻編碼數(shù)據(jù)  -VN 禁止視頻  

ffmpeg -i test_1280x720.mp4 -acodec copy -vn audio.mp4

#提取視頻   -vcodec copy 直接拷貝視頻編碼數(shù)據(jù)    -an 禁止音頻

ffmpeg -i test_1280x720.mp4 -vcodec copy -an video.mp4

#提取視頻

ffmpeg -i test_1280x720.mp4 -vcodec copy -an test_lpf.h264

#強(qiáng)制格式

ffmpeg -i test_1280x720.mp4 -vcodec libx264 -an test_lpf.h264

#提取音頻

ffmpeg -i test_1280x720.mp4 -acodec copy -vn test_lpf.aac

#強(qiáng)制格式

ffmpeg -i test_1280x720.mp4 -acodec libmp3lame -vn test_lpf.mp3

#提取yuv數(shù)據(jù)  提取3秒數(shù)據(jù),分辨率和源視頻一致

ffmpeg -i test_1280x720.mp4 -t 3 -pix_fmt yuv420p yuv420p_orig.yuv

#提取3秒數(shù)據(jù),分辨率轉(zhuǎn)為320x240

ffmpeg -i test_1280x720.mp4 -t 3 -pix_fmt yuv420p -s  640*480 yuv420p_320x240.yuv

#播放yuv 視頻數(shù)據(jù) 必須指定分辨率 否則會(huì)綠屏以及花屏

ffplay -i yuv420p_640x480.yuv -s 640*480

#提取3秒數(shù)據(jù),分辨率轉(zhuǎn)為320x240

ffmpeg -i test.mp4 -t 3 -pix_fmt rgb24 -s 320x240 rgb24_320x240.rgb

#rgb 格式的數(shù)據(jù)進(jìn)行播放 必須指定 pixel_format rgb24  必須指定分辨率  否則播放不出來(lái)  如果不指定pixel_format 會(huì)花屏綠屏

ffplay -i rgb24_320x240.rgb -pixel_format rgb24 -video_size 320*240

#RGB和YUV之間的轉(zhuǎn)換

ffmpeg -s 640*480 -i yuv420p_640x480.yuv  -pix_fmt yuv420p -pix_fmt rgb24 -s 640*480 rgb24_640x480.rgb

#播放rgb 必須指定pixel_format 以及分辨率

ffplay -i rgb24_640x480.rgb -pixel_format rgb24 -s 640*480

#更改封裝格式

ffmpeg -i test_1280x720.mp4 -vcodec copy -acodec copy test_copy.ts

ffmpeg -i test_1280x720.mp4 -codec copy test_copy2.ts

#改變編碼格式

ffmpeg -i test_1280x720.mp4 -vcodec libx265 -acodec libmp3lame out_h265_mp3.mkv

#改變幀率

ffmpeg -i test_1280x720.mp4 -r 15 output2.mp4

#修改視頻碼率:

ffmpeg -i test.mp4 -b 400k output_b.mkv

#修改視頻碼率:

ffmpeg -i test.mp4 -b:v 400k output_bv.mkv

#修改音頻碼率: 如果不想重新編碼video,需要加上-vcodec copy

ffmpeg -i test.mp4 -b:a 192k output_ba.mp4

#修改音視頻碼率:

ffmpeg -i test.mp4 -b:v 400k -b:a 192k output_bva.mp4

#修改視頻分辨率:

ffmpeg -i test.mp4 -s 480x270 output_480x270.mp4

#修改音頻采樣率: 

ffmpeg -i test.mp4 -ar 44100 output_44100hz.mp4

#畫(huà)中畫(huà) 副視頻停下之后默認(rèn)顯示最后一幀圖像

ffplay -i input.mp4 -vf "movie=sub_320x240.mp4[sub];[in][sub]overlay=x=20:y=20[out]"

#eof_action=1 表示短的視頻停止之后都會(huì)停止

ffplay -i input.mp4 -vf "movie=sub_320x240.mp4[sub];[in][sub]overlay=x=20:y=20:eof_action=1[out]"

#短的視頻結(jié)束了 畫(huà)面直接結(jié)束

ffplay -i input.mp4 -vf "movie=sub_320x240.mp4[sub];[in][sub]overlay=x=20:y=20:eof_action=2[out]"

#shortest=1 表示短的視頻停止之后都會(huì)停止

ffplay -i input.mp4 -vf "movie=sub_320x240.mp4[sub];[in][sub]overlay=x=20:y=20:shortest =1[out]"

#對(duì)副視頻視頻進(jìn)行縮放

ffplay -i input.mp4 -vf "movie=sub_320x240.mp4,scale=640x480[sub];[in][sub]overlay=x=20:y=20[out]"

#跑馬燈

ffplay -i test_60_1280x720.mp4 -vf "movie=test_60_1280x720.mp4,scale=320x270[test];[in][test]overlay=x=mod(50*t\,main_w):y=abs(sin(t))*main_h*0.7[out]"

#雙宮格

ffmpeg -i 1.mp4 -i 2.mp4 -i 3.mp4 -i 4.mp4 -filter_complex "nullsrc=size=640x480[base];[0:v]setpts=PTS-STARTPTS,scale=320x240[upperleft];[1:v]setpts=PTS-STARTPTS,scale=320x240[upperright];[base][upperleft]overlay=shortest=1[tmp1];[tmp1][upperright]overlay=shortest=1:x=320" out2.mp4

#四宮格

ffmpeg -i 1.mp4 -i 2.mp4 -i 3.mp4 -i 4.mp4 -filter_complex "nullsrc=size=640x480[base];[0:v] setpts=PTS-STARTPTS,scale=320x240[upperleft];[1:v]setpts=PTS-STARTPTS,scale=320x240[upperright];[2:v]setpts=PTS-STARTPTS, scale=320x240[lowerleft];[3:v]setpts=PTS-STARTPTS,scale=320x240[lowerright];[base][upperleft]overlay=shortest=1[tmp1];[tmp1][upperright]overlay=shortest=1:x=320[tmp2];[tmp2][lowerleft]overlay=shortest=1:y=240[tmp3];[tmp3][lowerright]overlay=shortest=1:x=320:y=240" out3.mp4

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多