Skip to content

Instantly share code, notes, and snippets.

@DecentMakeover
Last active May 21, 2019 09:11
Show Gist options
  • Save DecentMakeover/e4a87089dcc9be29dbbe6bf36d9c26ae to your computer and use it in GitHub Desktop.
Save DecentMakeover/e4a87089dcc9be29dbbe6bf36d9c26ae to your computer and use it in GitHub Desktop.
frames =5
video_folder = '/media/ryan/shakira/3d-cnn-action-recognition/some_folder'
for file in os.listdir(video_folder):
if file.endswith('.webm'):
os.mkdir(os.path.join(video_folder,file.split('.')[0]))
folder_name = file.split('.')[0]
os.system('ffmpeg -t 4 -i {} -vf fps={} {}/%05d.jpg -t 10'.format(os.path.join(video_folder,file), frames,os.path.join(video_folder,folder_name )))
elif file.endswith('.mp4'):
os.mkdir(os.path.join(video_folder,file.split('.')[0]))
folder_name = file.split('.')[0]
os.system('ffmpeg -t 4 -i {} -vf fps={} {}/%05d.jpg -t 10'.format(os.path.join(video_folder,file), frames,os.path.join(video_folder,folder_name )))
elif file.endswith('.blob'):
os.mkdir(os.path.join(video_folder,file.split('.')[0]))
folder_name = file.split('.')[0]
os.system('ffmpeg -i {} -vf fps={} {}/%05d.jpg'.format(os.path.join(video_folder,file), frames,os.path.join(video_folder,folder_name )))
else:
print('*********************************************************', file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment