---
title: "Discussion on \"Catch Black Frames and Frozen Video Before You Upload: ffmpeg blackdetect + freezedetect in 90 Lines of Python\" | Hashnode"
description: "Discussion on \"Catch Black Frames and Frozen Video Before You Upload: ffmpeg blackdetect + freezedetect in 90 Lines of Python\". One decode pass, two filters, a CI-friendly exit code, and the freezedetect quirk that hides a frozen ending"
url: "https://hashnode.com/posts/catch-black-frames-and-frozen-video-before-you-upload-ffmpeg-blackdetect-freezedetect-in-90-lines-of-python/6b0b7eeb141ee22688824865"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Catch Black Frames and Frozen Video Before You Upload: ffmpeg blackdetect + freezedetect in 90 Lines of Python](https://jadenvo259.hashnode.dev/catch-black-frames-and-frozen-video-before-you-upload-ffmpeg-blackdetect-freezedetect-in-90-lines-of-python?utm_source=hashnode&utm_medium=feed)

One decode pass, two filters, a CI-friendly exit code, and the freezedetect quirk that hides a frozen ending

3d ago · 6 min read · jadenvo259.hashnode.dev  
Read the article

-   [#video](https://hashnode.com/tag/video)
-   [#automation](https://hashnode.com/tag/automation)
-   [#python](https://hashnode.com/tag/python)
-   [#ffmpeg](https://hashnode.com/tag/ffmpeg)

## Written by

[Jaden Vo](https://hashnode.com/@jadenvo259)

@jadenvo259

  
[View profile](https://hashnode.com/@jadenvo259)

## Responses 2

Markdown supported · ⌘↵ to post

[Bishal Paul](https://hashnode.com/@bishal-paul)

[3d ago](https://hashnode.com/posts/catch-black-frames-and-frozen-video-before-you-upload-ffmpeg-blackdetect-freezedetect-in-90-lines-of-python/6b0b7eeb141ee22688824865/comment/6b0be500d554d34b994e8a02)

The freezedetect quirk is a good catch. A freeze that runs to the last frame never gets an end line, so closing the span at the file duration is the right fix. I'd have assumed a clean log meant a clean video. The idea of generating deliberately broken test clips instead of hunting for real ones is also what makes the script trustworthy in CI.

[Jaden Vo](https://hashnode.com/@jadenvo259)

[2d ago](https://hashnode.com/posts/catch-black-frames-and-frozen-video-before-you-upload-ffmpeg-blackdetect-freezedetect-in-90-lines-of-python/6b0b7eeb141ee22688824865/comment/6b0be500d554d34b994e8a02#reply-6b0d6d152194ff0bb785a0a8)

Thanks, the frozen ending one bit me first, the log looked totally clean. Glad the broken test clips idea made sense.
