-
Notifications
You must be signed in to change notification settings - Fork 510
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
[BUG] Export video to images causes blockiness #4194
Comments
Interesting, thanks for the report. Needs @brimoor 's input, I don't think this code has been touched in a long time. But with some cursory research, here's some observations.
Looks like we use a default of 23 and a present of Downside to crf
|
So I tested values for -q:v 20,15,12,10,8 which all gave blocky results. Below 5 gave good results and it started to clear up starting from 8. -crf 17,18 and 23 did not improve anything in particular that I noticed. -preset medium with options -crf 17,18 and 23 didnt work either nor did -preset high or -preset low with -crf 17 For the record this is the default cmd when running you get fouv.sample_videos(dataset, force_sample=True): As I was testing I realized i cant (or I dont know how to) actually use kwargs['out_opts'] with this function because they are removed in def _transform_video() since reencoding will always be required by sample_videos(). When in and out options are always reset. This happens in https://github.com/voxel51/fiftyone/blob/develop/fiftyone/utils/video.py: line 903 In regards to your 3rd bullet. I do see what you mean and I get it if this just too specific a case but I thought it was worth bringing up at least. |
Describe the problem
This stackoverflow entry sums everything up neatly with images as reference.
https://video.stackexchange.com/questions/8621/ffmpeg-output-is-blocky
The TLDR is; videos exported to images are in a low quality. I get the exact blockiness as seen in the stackoverflow post.
This issue is quite deceptive as the first few frames are not blocky so it can be easy to overlook for a user (the reason i flagged this as a bug).
My hotfix is to pass -q:v 1 to the FFMPEG cmd as seen bellow (which is already quite convenient).
kwargs = {"out_opts": '-q:v", "1'}
fouv.sample_videos(dataset, force_sample=True, reencode = True , **kwargs)
This comes down to that the ETA library does not include this FFMPEG setting by default.
I cant tell if this is intentional by fiftyone to reduce space but if it isnt then I would propose:
To include this by default in fiftyone/utils/video.py in the function _transform_video()
Code to reproduce issue
I used the code below, but i tried several other ways to export images from a video and got the same results.
fouv.sample_videos(dataset, force_sample=True, reencode = True)
System information
python --version
): Python 3.10.12fiftyone --version
): FiftyOne v0.23.7Willingness to contribute
The FiftyOne Community encourages bug fix contributions. Would you or another
member of your organization be willing to contribute a fix for this bug to the
FiftyOne codebase?
from the FiftyOne community
The text was updated successfully, but these errors were encountered: