添加圖片字幕和片尾(overlay and concat )

得知這條命令還要感謝網(wǎng)友(游戲愛(ài)好者? 70000020)的提供,在此整理一下使用方法(有很多重復(fù)性的命令可以幫助大家理解命令的作用)。

O(∩_∩)O哈哈~,在此用一個(gè)好聽(tīng)的歌曲(新娘不是我-小蝦米)給大家作為demo。

素材地址:鏈接:http://pan.baidu.com/s/1bFauYE 密碼:834v


1、給視頻添加圖片字幕

ffmpeg -ss 00:00:00 -t 00:00:22 -i xiami_xinniangbushiwo.mp4 -i subtitle_1.png -i subtitle_2.png -filter_complex " [0:v][1:v]overlay=x=50:y=300:enable='between(t,0,5.420000)'[out_1];[out_1][2:v]overlay=x=50:y=300:enable='between(t,6.022000,10.852000)'[out_2];[out_2][1:v]overlay=x=50:y=300:enable='between(t,11.022000,15.852000)'[out_3];[out_3][2:v]overlay=x=50:y=300:enable='between(t,16.022000,20.852000)' " -acodec copy -vcodec libx264 -b:v 500k -threads 4 -thread_type frame -preset faster -tune zerolatency -y test.mp4

黑體部分為主要功能命令,命令中(-i xiami_xinniangbushiwo.mp4)可以用(-f concat -i filelist.txt)替換,后者用于批處理多個(gè)視頻文件

?附帶一些命令的解釋,第一次寫簡(jiǎn)書(shū),所有啰嗦一下:

-ss 截圖視頻的起始位置(hh:mm:ss); -t 截圖視頻的長(zhǎng)度(hh:mm:ss);-acodec copy 音頻沒(méi)有重編碼,直接copy原始aac音頻流;-vcodec libx264 因?yàn)槭莖verlay,所以視頻不能copy(這也是好多朋友不明白原理想要去copy和overlay一起用),這里用的libx264;-b:v 500k 設(shè)置視頻編碼碼率為500kbps;-threads 4 (Number of encoding threads);-thread_type frame (Set multithreading technique. Possible values: ‘slice’ Slice-based multithreading. It generates the same effect asx264’s--sliced-threadsoption. ‘frame’ Frame-based multithreading);-preset faster -tune zerolatency 編碼預(yù)設(shè)?


2、給視頻添加圖片字幕,并添加微信二維碼片尾

ffmpeg -ss 00:00:00 -t 00:00:22 -i xiami_xinniangbushiwo.mp4 -i subtitle_1.png -i subtitle_2.png -loop 1 -t 4.5 -i tail-leader.jpg -filter_complex " [0:v][1:v]overlay=x=50:y=300:enable='between(t,0,5.420000)'[out_1];[out_1][2:v]overlay=x=50:y=300:enable='between(t,6.022000,10.852000)'[out_2];[out_2][1:v]overlay=x=50:y=300:enable='between(t,11.022000,15.852000)'[out_3];[out_3][2:v]overlay=x=50:y=300:enable='between(t,16.022000,20.852000)'[out_4];[3:v]scale=w=480:h=360[out_5];[out_4][out_5]concat " -acodec copy -vcodec libx264 -b:v 500k -threads 4 -thread_type frame -preset faster -tune zerolatency -y test.mp4

黑體部分為主要功能命令,命令中(-i xiami_xinniangbushiwo.mp4)可以用(-f concat -i filelist.txt)替換,后者用于批處理多個(gè)視頻文件

[3:v]scale=w=480:h=360[out_5] 此處對(duì)于微信二維碼圖片進(jìn)行了一次scale,因?yàn)樵家曨l尺寸為480x360,而圖片為480x480,如果圖片尺寸和原始視頻尺寸一樣的話,可以省略這一步,直接用?[out_4][3:v]concat 即可;

-loop 1 -t 4.5 -i tail-leader.jpg 代表微信二維碼圖片持續(xù)4.5s


O(∩_∩)O哈哈~,第一次寫文章,啥都別說(shuō)了,打賞我吧?。?! 哈哈

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 最近開(kāi)始學(xué)習(xí)Python,于是通過(guò)練習(xí)題來(lái)強(qiáng)化所學(xué)基礎(chǔ)知識(shí)。 有四個(gè)數(shù)字:1、2、3、4,能組成多少個(gè)互不相同且無(wú)...
    于闐閱讀 482評(píng)論 0 0
  • Day69 好可愛(ài),軟糯軟糯的。(^.^)
    小懶說(shuō)Yolo閱讀 301評(píng)論 4 6
  • 有一個(gè)穿越時(shí)空的印度留學(xué)生來(lái)到中國(guó),留學(xué)一個(gè)月后回國(guó)了。 他的父親和兒子見(jiàn)面后,覺(jué)得兒子在中國(guó)呆的時(shí)間太短,有點(diǎn)不...
    紫羽說(shuō)閱讀 349評(píng)論 7 11

友情鏈接更多精彩內(nèi)容