我正在制作一个分段程序来干预ffmpeg的write_frame函数,并将输出数据写入不同的文件。每个分段文件包含大约3秒的视频片段。
守则如下:
1 - Get transcoded packet
2 - Check if it contains key frame data, if yes goto 3.
3 - Check the duration of current segment, if it exceed 3 seconds, goto 4
4 - Close file, and create new segment, write packet to segment fi
当我用ffmpeg剪辑视频时,我似乎丢失了帧。
以下是我采取的步骤:
获取要剪切的帧号->将帧号转换为hh:mm:ss.ms格式->运行ffmpeg进程
代码如下:
import subprocess
def frames_to_timecode(frame,frameRate):
'''
Convert frame into a timecode HH:MM:SS.MS
frame = The frame to convert into a time code
frameRate = the frame rate of t