Skip to content

the frame extractor for Video Datasets with GPU Acceleration

License

Notifications You must be signed in to change notification settings

titania7777/FrameExtractor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FrameExtractor

the frame extractor for Video Datasets with GPU Acceleration, powered by Decord

  • if you want to use GPU then you will need to install from the source, detail is follow the readme of Decord repository

My Environment Setting

  • Decord == 0.4.2
  • opencv-python == 4.4.0.44
  • pillow-simd == 7.0.0.post3
  • ffmpeg-python == 0.2.0

Usage

  • first download the Video Dataset, for example an ActivityNet use a crawler or request and then you will get the follow structure
   v1-3 (ActivityNet version 1.3)
     L train
         L xxx.mp4
             .
             .
     L val
     L test

then you can run a script like below

  • extract only frames (cpu version, just remove '--use-gpu' flag)
python frame_extractor.py --videos-path ./v1-3/ --frames-path ./frames/ --frame-size 240 --quality 0.7 --use-gpu
  • extract only optical flows (only cpu)
python frame_extractor.py --videos-path ./v1-3/ --flows-path ./flows/ --frame-size 240 --quality 0.7 --flow-mode
  • if you want get origin size of frames in video then adds '--origin-size' flag

i use the ffmpeg when using a cpu, do if you need consider of quality then check it below formula and table

ffmpeg_qscale = (1 - args_quality) * 30 + 1

args_quality = (31 - ffmpeg_qscale) / 30

args_quality ffmpeg_qscale
1.0 1
0.9 4
0.8 7
0.7 10
0.6 13
0.5 16
0.4 19
0.3 22
0.2 25
0.1 28
0.05 29.5
0.0 31

About

the frame extractor for Video Datasets with GPU Acceleration

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages