Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find another method for efficiently sampling frames from video? #326

Open
brimoor opened this issue Oct 28, 2019 · 0 comments
Open

Find another method for efficiently sampling frames from video? #326

brimoor opened this issue Oct 28, 2019 · 0 comments
Labels
bug Bug fixes enhancement Code enhancement

Comments

@brimoor
Copy link
Contributor

brimoor commented Oct 28, 2019

eta.core.video.sample_select_frames(..., fast=True) uses an ffmpeg command of the form

ffmpeg -i video.mp4 -vf select='eq(n\,5)+eq(n\,15)+eq(n\,25)' -vsync 0 frames-%03d.png

to sample specific frames from the video. Unfortunately, for long videos with lots of frames to sample, we get a bash(?) error indicating that the ffmpeg command is too long...

Traceback (most recent call last):
  File "/engine/theta/eta/eta/modules/sample_videos.py", line 177, in <module>
    run(*sys.argv[1:])
  File "/engine/theta/eta/eta/modules/sample_videos.py", line 173, in run
    _sample_videos(config)
  File "/engine/theta/eta/eta/modules/sample_videos.py", line 107, in _sample_videos
    _process_video(data.input_path, data.output_frames_dir, parameters)
  File "/engine/theta/eta/eta/modules/sample_videos.py", line 161, in _process_video
    input_path, frames, output_patt=output_patt, size=size, fast=True)
  File "/engine/theta/eta/eta/core/video.py", line 1872, in sample_select_frames
    ffmpeg.run(video_path, tmp_patt)
  File "/engine/theta/eta/eta/core/video.py", line 3020, in run
    self._p = Popen(self._args, stdin=PIPE, stdout=PIPE, stderr=PIPE)
  File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 7] Argument list too long: 'ffmpeg'

One can always use fast=False in this method, but one needs a constant-command-sized method to efficiently sample frames and naming them according to their frame number in the original video.

@brimoor brimoor added bug Bug fixes enhancement Code enhancement labels Oct 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug fixes enhancement Code enhancement
Projects
None yet
Development

No branches or pull requests

1 participant