-
Notifications
You must be signed in to change notification settings - Fork 261
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
Video start_time not set to 0, black screen preview in QuickTime #644
Comments
writer.WriteFrame(&timeline, 0, 10 * 25); That should be |
Interestingly, the loop in WriteFrame passes the libopenshot/src/FFmpegReader.cpp Lines 818 to 827 in 9efa359
There's also either a bug or a documentation bug in FFmpegWriter, since based on this loop: libopenshot/src/FFmpegWriter.cpp Lines 801 to 812 in 9efa359
The third argument to for (int64_t number = start; number < (start + length); number++) { |
Still not super clear on why you're getting a blank first frame / start time offset, since it seems like what should be happening is that the first frame ends up doubled (after the I suppose it could be that FFmpeg is detecting the duplicate frame, and applying some sort of mitigation that drops the first and shifts the start time to the time index of the second. |
Also, it seems incredibly dumb to me that the code would just forcibly adjust an out-of-bounds frame number, then proceed as if nothing's wrong — rather than, say, throwing an exception. Hard to see how that's really doing anyone any favors. There's even an exception defined just for that purpose: Lines 284 to 300 in 9efa359
Currently
...And I'm not even sure that second one is really a valid use of the |
Actually, scratch that, I'm sure it's not. When built with any recent FFmpeg version, the |
Thanks @ferdnyc for your detailed analysis as always. I tried with:
But still got the same start_time of 0.040000 I also tried different start frame numbers, i.e.:
And still get the same start_time. We're you able to recreate this issue? |
Thank you so much for submitting an issue to help improve OpenShot Video Editor. We are sorry about this, but this particular issue has gone unnoticed for quite some time. To help keep the OpenShot GitHub Issue Tracker organized and focused, we must ensure that every issue is correctly labelled and triaged, to get the proper attention. This issue will be closed, as it meets the following criteria:
We'd like to ask you to help us out and determine whether this issue should be reopened.
Thanks again for your help! |
It seems that when rendering video, the very first frame is not written at start_time 0 but instead at 0.04 (at 25 fps, it skips one frame).
This might not seem like a big problem and I think most viewers/players get around this but QuickTime players (including iPhone) shows the first frame as black instead of the first frame of the video. I think this affects preview thumbnails on iPhones too.
QuickTime shows a black screen when the video loads:
To fix this I can run a simple ffmpeg command, which just copies the video but it resets the start_time setting to 0 and the preview/first frame displays correctly:
ffmpeg -i original.mp4 -c copy fixed.mp4
This is the expected result with the first frame used as a preview/poster image:
To recreate this issue:
Run the following code to render a video clip:
Check the start_time using ffprobe:
ffprobe -v error -select_streams v:0 -show_entries stream=start_time -of default=noprint_wrappers=1 original.mp4
You should get a value:
start_time=0.040000
To fix it:
ffmpeg -i original.mp4 -c copy fixed.mp4
Check the start_time using ffprobe:
ffprobe -v error -select_streams v:0 -show_entries stream=start_time -of default=noprint_wrappers=1 fixed.mp4
You should get a value:
start_time=0.000000
You can compare in QuickTime too.
Is this something that can be fixed in libopenshot rather than afterwards using ffmpeg? Or is there a setting I'm missing that will force the first frame to be written at 0.00000. Is this a bug or a design choice? I think somewhere in the code it must be skipping frame 0 and starts at frame 1 (0.04 seconds at 25 fps).
Any feedback on this would be appreciated. If it's a bug we can probably dedicate some resources to fixing this.
The text was updated successfully, but these errors were encountered: