-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Set frame rate of video extracting #382
Conversation
if frame_rate > 0: | ||
output_opts += ' -r ' + str(frame_rate) | ||
else: | ||
output_opts += ' -vsync 0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Option -vsync 0
is very important. It allows to generate non-duplicated frames. -r can lead to duplicated frames and in general it is bad
- need to annotate the same frame twice
- there is no correspondence between frame and video. What does frame Register new users #3 mean? Is it duplication of frame Support Pascal VOC Format #2? Is it an unique frame?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tried to keep the vsync options. But if both -vsync and -r options are specified, ffmpeg reports error:
"Using -vsync 0 and -r can produce invalid output files"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zliang7, this is why '-r' option is not good here. See my thoughts below.
nm/rest_api should replace develop very soon. Could you please submit your changes into nm/rest_api branch? |
@@ -272,13 +272,17 @@ def rq_handler(job, exc_type, exc_value, traceback): | |||
############################# Internal implementation for server API | |||
|
|||
class _FrameExtractor: | |||
def __init__(self, source_path, compress_quality, flip_flag=False): | |||
def __init__(self, source_path, compress_quality, flip_flag=False, frame_rate=0): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main problem with the approach is you will get annotation file which doesn't correspond to the video file. For example, originally you have a video file with 30FPS. If someone annotates the whole video file we will get <frame000000>, <frame000001>, ...
inside the annotation file for every frame. Now you say that we can provide "custom" FPS. You will get another <frame000000>, <frame000001>, ...
which don't correspond to the original video file. How to match if you don't store extra parameters (e.g. custom frame rate) inside the annotation file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with the internals of backend. Is there any difference between upload a video directly with upload all frame images pre-extracted locally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zliang7, if you still have questions it is better to organize a meeting and discuss.
Let me clarify my vision for the feature:
|
May be for unification the default value for |
One more important note. The same approach can work not only for a video file. It can work for a set of images or an archive. All these parameters above should be as a part of rest api and go to DB as well. |
This value means how many image files generated per second. To reduce the number of image files, the value must be less than the video FPS.
@zliang7 , should we expect a new patch for the issue or just close the PR? |
@nmanovic , it's OK to close this PR. I will try to submit again after your restful api PR get merged. But before that, I need some time to understand your huge change to rebase/change this one. I still have some questions about your thoughts. Instead of setup a meeting to discuss, I prefer to discuss in the issue page. So everyone can see it and join the discussion, since |
OK. Let's make one more iteration with the PR. I will close it for now. |
This value means how many image files generated per second.
To reduce the number of image files, the value must be less than
the video FPS.