Skip to content
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

Black Frame detection using ffprobe #212

Draft
wants to merge 467 commits into
base: main
Choose a base branch
from

Conversation

leta-lpb
Copy link

ffprobe code to detect black frames:

ffprobe -f lavfi -i movie="input.mp4,blackdetect[out0]" -show_entries tags=lavfi.black_start,lavfi.black_end -of default=nw=1

Output displays line by line as each black frame is found.

TAG:lavfi.black_start=35.7691
TAG:lavfi.black_start=35.7691
TAG:lavfi.black_end=37.0704
TAG:lavfi.black_end=37.0704
TAG:lavfi.black_start=53.9205
TAG:lavfi.black_start=53.9205
TAG:lavfi.black_end=54.1207
TAG:lavfi.black_end=54.1207
TAG:lavfi.black_start=68.9689
TAG:lavfi.black_start=68.9689
TAG:lavfi.black_end=69.4694
TAG:lavfi.black_end=69.4694
TAG:lavfi.black_start=75.7423
TAG:lavfi.black_start=75.7423
TAG:lavfi.black_end=76.2095
TAG:lavfi.black_end=76.2095
TAG:lavfi.black_start=1617.95
TAG:lavfi.black_start=1617.95
TAG:lavfi.black_end=1618.25
TAG:lavfi.black_end=1618.25
TAG:lavfi.black_start=1635.1
TAG:lavfi.black_start=1635.1
TAG:lavfi.black_end=1635.33
TAG:lavfi.black_end=1635.33
TAG:lavfi.black_start=1650.18
TAG:lavfi.black_start=1650.18
TAG:lavfi.black_end=1650.68
TAG:lavfi.black_end=1650.68
TAG:lavfi.black_start=1656.96
TAG:lavfi.black_start=1656.96
TAG:lavfi.black_end=1657.76
TAG:lavfi.black_end=1657.76
TAG:lavfi.black_start=1660.03
TAG:lavfi.black_start=1660.03
[Parsed_movie_0 @ 0000020c41f67b00] EOF timestamp not reliable
[blackdetect @ 0000020c41f470c0] black_start:1660.03 black_end:1980.48 black_duration:320.453

errors in the file can appear such as the "EOF timestamp not reliable" error seen above. The processing time would almost necessitate using await as the file in its entirety is scanned and can take multiple minutes to complete.

rosenbjerg and others added 30 commits May 11, 2020 00:04
…fmpeg

Added Codec, PixelFormat and ContainerFormat classes
This reverts commit d95f687.
completely in-memory is now possible
@rosenbjerg
Copy link
Owner

Hey @leta-lpb
Forgot about this PR, sorry

What inputs would a method wrapping this functionality take?
Where does the 1 in default=nw=1 come from? Should it be a parameter? And same for the 0 in [out0]
Does this only work with file input, or do you think it would work it any IInputArgument?

@leta-lpb
Copy link
Author

leta-lpb commented Aug 2, 2022

Hey @leta-lpb Forgot about this PR, sorry

What inputs would a method wrapping this functionality take? Where does the 1 in default=nw=1 come from? Should it be a parameter? And same for the 0 in [out0] Does this only work with file input, or do you think it would work it any IInputArgument?

Sorry for the extremely late reply. The only input for the method would be the file location to be processed. The 0 in the out0 is just specifying the first stream in the output that's being scanned for black. It's part of the filtergraph processing and it's pretty much required. It's highly unlikely someone would ever be scanning a video with multiple streams in it. The default=nw=1 is how you get the nice output. Take that out and you get incoherent nonsense, not the output listed above. The benefit of this data is you could do some fun things where you automatically slice up video based on the numbers received. If you create video with planned black in it and run this, you could get slice times that you could then feed into another method and automatically slice up videos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.