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

check if the stream contains mjpeg as codec_name, then treat media as audio #91

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Rushi1109
Copy link

fixes the bug raised in #90

The ffprobe tool is used to check if any stream contains codec_name as mjpeg.

If mjpeg is present, the media is treated as Audio, other media is treated as Video

@omeryusufyagci
Copy link
Owner

Hey @Rushi1109, thanks for the PR. Frankly, I wasn't familiar with the full output set of ffprobe, but from what I see they provide disposition.attached_pic as a field in itself. Could you please get the json output which should give you a list of streams, with each stream providing you this field. From what I briefly checked, that should literally be what we're looking for.

Thanks for checking!

@omeryusufyagci omeryusufyagci added bug Something isn't working core Media processing component, the core C++ binary. iteration Requires further iteration for approval labels Dec 24, 2024
@Rushi1109
Copy link
Author

Hey @omeryusufyagci,

When looking at the raw data of the media I see DISPOSITION:attached_pic = 1 for stream index 2 which is the video stream.

But, When I tried to get the information about disposition.attached_pic from ffprobe tool, I am not able to get it's value. I tried extracting from json but still it's not showing attached_pic for that file. Do you have any idea about why it's getting filtered out, by ffmpeg?

@Rushi1109
Copy link
Author

Moreover @omeryusufyagci,

I have researched a bit and got to know that If the video stream contains a static image, the average frame rate for that stream will be 0/0. My current implementation is using the avg_frame_rate from video stream and decides the media type.

Do you see any issue with this approach?

@omeryusufyagci
Copy link
Owner

Hey @omeryusufyagci,

When looking at the raw data of the media I see DISPOSITION:attached_pic = 1 for stream index 2 which is the video stream.

But, When I tried to get the information about disposition.attached_pic from ffprobe tool, I am not able to get it's value. I tried extracting from json but still it's not showing attached_pic for that file. Do you have any idea about why it's getting filtered out, by ffmpeg?

Please make sure you include disposition after the -show_entries flag, e.g. -show_entries stream=index,<other_stuff>,disposition.

Could you try like that, and if there's still an issue please provide the command you used and the output you received.

I have researched a bit and got to know that If the video stream contains a static image, the average frame rate for that stream will be 0/0. My current implementation is using the avg_frame_rate from video stream and decides the media type.

Do you see any issue with this approach?

Thanks for figuring this out! Good to know that'd be a valid fix. The disposition.attached_image would be a more robust solution, as it explicitly identifies cover images and aligns better with the intent of filtering out such streams.

Could you please verify this and let me know if it resolves the issue? Thank you!

@Rushi1109
Copy link
Author

Please make sure you include disposition after the -show_entries flag, e.g. -show_entries stream=index,<other_stuff>,disposition

Yes I included disposition. I am using the same command of ffprobe but instead of avg_frame_rate, I added disposition and removed that awk command. But, I am not seeing any output for disposition.

Can you check it on your side? Do you see disposition in output?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working core Media processing component, the core C++ binary. iteration Requires further iteration for approval
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants