2.1 用ffmpeg分割視頻

用ffmpeg分割視頻的方法

 

分割視頻並重新壓制,避免各種問題,就是費時

ffmpeg -ss [start] -t [duration] -i [in].mp4 -c:v libx264 -c:a aac -strict experimental -b:a 98k [out].mp4

ffmpeg -i [in].mp4 -ss [start] -to [end] -c:v libx264 -c:a aac -strict experimental -b:a 98k [out].mp4

 

參數分析:

-ss:start time
-t :duration

-i : source

-c :video,audio codec

 

第二種方法先寫輸入文件,再搞定時間


-to:end time 此參數要放在-i 的後面

 

時間格式:

    x秒
    HOURS:MM:SS.MICROSECONDS

 

如果不重新壓制也可以用

ffmpeg -ss [start] -t [duration] -accurate_seek -i [in].mp4 -codec copy -avoid_negative_ts 1 [out].mp4

 

-accurate_seek 精確搜索
-avoid_negative_ts 避免黑屏,參數設爲1

 

參考:

http://www.ruanyifeng.com/blog/2020/01/ffmpeg.html

https://www.jianshu.com/p/533ac2776ce4

https://blog.csdn.net/matrix_laboratory/article/details/53157383

http://trac.ffmpeg.org/wiki/Seeking

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章