WyattBlue / auto-editor

Auto-Editor: Efficient media analysis and rendering
https://auto-editor.com
The Unlicense
2.86k stars 418 forks source link

Black frames every once in a while #468

Open emrepun opened 4 months ago

emrepun commented 4 months ago

Bug description

I have a screen recording video created with Quicktime Player in .mov format. I tried using auto-editor to cut silences. It works fine but every few seconds there are black frames blinking in the result video. I tried a video that was around 13 mins long.

Not sure if this helps but, I have tried another video though that was only 54 seconds, and the issue didn't happen there.

What's your platform?

Python Version: 3.12.3 64-bit
Platform: Darwin 23.2.0 x86_64
FFmpeg Version: N-110230-g1179bb703e-6.0
FFmpeg Path: /usr/local/lib/python3.12/site-packages/ae_ffmpeg/Darwin-x86_64/ffmpeg
Auto-Editor Version: 24w19a

What command did you use

auto-editor test_video_3.mov --margin 0.2sec

What properties does your input video have?

test_video_3_ALTERED.mov:


Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test_video_3_ALTERED.mov': Metadata: major_brand : qt
minor_version : 512 compatible_brands: qt
creation_time : 2024-05-23T07:33:41.000000Z encoder : Lavf60.4.101 Duration: 00:10:32.57, start: 0.000000, bitrate: 10160 kb/s Stream #0:0[0x1]: Video: h264 (High) (avc1 / 0x31637661), yuv420p(bt709, progressive), 3456x2110, 10024 kb/s, SAR 1:1 DAR 1728:1055, 59.62 fps, 59.62 tbr, 11924 tbn (default) Metadata: creation_time : 2024-05-23T07:33:41.000000Z handler_name : VideoHandler vendor_id : FFMP Stream #0:1[0x2]: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default) Metadata: creation_time : 2024-05-23T07:33:41.000000Z handler_name : SoundHandler vendor_id : [0][0][0][0] At least one output file must be specified

Comments

No response

JamesPaulKnox commented 4 months ago

I too had this problem with 24w19a, I was able to resolve it by downgrading my version to 24w13a without making any other changes in my set up.

The release notes for 24w19a list "Round timebase to two-digits, which should fix a Premiere Pro issue" as a change

My theory is that rounding to only two-digits allows an occasional blank spot in the timeline, where the end of a clip just-so-happens to round down and the beginning of the next clip just-so-happens to round up, leaving a 0.01s undefined area, thus causing a black screen for a moment.

I have not done any testing to positively identify this, but I have observed these black moments occur whenever edits begin/end with varying frequency. This observation supports my theory.

My videos are longer, 30m to 90m in length. The bug happens both with "--my-ffmpeg" and without. The bug happens with my preferred codec h264_nvenc and any other codec I tried at the time to troubleshoot. The bug happens both when I have lots of custom options and when I have all defaults. In summary, I did not observe any changes in the bugs behavior by changing my command's arguments.

Therefore, I believe the root cause of this bug is the rounding changes in version 24w19a.

emrepun commented 4 months ago

Thanks for your answer @JamesPaulKnox I just tried with the previous version, but unfortunately the issue still persists.

WyattBlue commented 3 months ago

24w25a makes this issue much rarer although it still happens.

quezadaesteban commented 3 weeks ago

I faced a similar issue. Updating didn't fix it. What fixed it was to use ffmpeg to re-encode the video using H.264 and ACC before passing it to auto-editor. This is the command I used:

 ffmpeg -i input.mp4 -c:v libx264 -preset slow -crf 22 -c:a aac -b:a 128k output.mp4