-
-
Notifications
You must be signed in to change notification settings - Fork 826
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
Added VFR Detection #3376
Added VFR Detection #3376
Conversation
Stash gets the frame_rate from ffprobe here Line 167 in cf0ce6c
It uses the avg_frame_rate field of the first video stream. For some files (older wmvs usually) this is 0/0 so the code above sets that to 0.There was also a fallback to get the r_frame_rate field if the above was 0, but i am not sure where that is used (only when generating ?) atm.@JoeSmithStarkers out of curiocity can you provide the output of one of those files with ffprobe -print_format json -show_format -show_streams filename.mp4 ? (redact filename/meta if needed)
|
@bnkai here you go. I think these files might be created via vlc doing some sort network capture or screen capture, and only encoding frames when the a new frame is provided, streaming mjpeg. I can provide a sample file if you want, i have 240 ish of them, probably a smallish one in there.
|
@JoeSmithStarkers thanks for the sample I couldnt replicate the issue as i dont have similar files, i did try though with a few wmvs that have In conclusion
|
…ure/add-vfr-detection-v18
This PR adds variable frame rate detection and optimisation to allow preview videos to be generated in a sane amout of time.
Problem: Some webcam captures are encoded with VFR, which ffmpeg sees as ridiculously high frames like 90,000. (In stash these high frame rates are mappped to 0 fps when ffprobe probes the video file, don't know why). When generating a preview for these files: ffmpeg with the default vsync 1 option, will respect the original frame rate 90k fps, and thus try to encode .75s of 90k frames for each chunk of the preview. This takes a long time.
The soultion is to dynamicly add the "-vsync 2" option to the ffmpeg command line which says ignore the frame rate of the original and use the internal timebase. This drastically improves the performance of preview generation.
This pr is a request for comment. Happy to make any improvements required.