2021年5月4日星期二

How to get first 16 fames from a video using ffmpeg?

I have a video mp4 file(5 seconds duration), it has 125 frames. I need to extract first 16 continuous frames into a folder. Can you please put the code for extracting first 16 frames?

I tried -

cmd = 'ffmpeg -i {} -frames:v 16 {}/%d.png'.format('/content/drive/MyDrive/MTP/train/X0.mp4', '/content/drive/MyDrive/MTP/sample')   subprocess.call(cmd, shell = True)  

and

cmd = 'ffmpeg -i {} -vf select=\'between(t,1,2)\' -vsync 0 {}/%d.png'.format('/content/drive/MyDrive/MTP/train/X0.mp4', '/content/drive/MyDrive/MTP/sample')  subprocess.call(cmd, shell = True)  
https://stackoverflow.com/questions/67358295/how-to-get-first-16-fames-from-a-video-using-ffmpeg May 02, 2021 at 11:48PM

没有评论:

发表评论