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
ffmpeg: Set audio channel count on AVFrame #20678
Conversation
LGTM. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably fine if it fixes the issue.
Thanks for the contribution!
Alright, just for completeness' sake I just tried ripping a cd (which seems to be the only place EncoderFFmpeg is used) and was able to verify the same problem. It's gonna take me a moment to setup a windows build to check that this will really fix it but then I'll add the change to EncoderFFmpeg as well. |
Before digging too much maybe make a note of the changes here: #20429 |
Good call, then there's no need to change anything here. Even better 👍🏽 |
Sorry for chiming in uninvited. But what else is needed for this to get merged? I'm only asking because I want to daily drive Libreelec with Nexus and this fix will make it possible to keep using as a media center. Please, let us know. Thanks Libreelec forum thread: https://forum.libreelec.tv/thread/24741-librelec-nightly-dolby-digital-transcoding-bug/#post165351 |
It has two approvals, just needs a green checkmark in Jenkins. Jenkins build and merge |
Thanks for replying to it. Forgive my ignorance. Jenkins is an automatic process name or a developer who still will revise it? |
Hi. Although the fix was applied and it worked. I'm encountering weird behavior. After a transcode into DD Is done. As in when I exit the video being played. I noticed that I lost all the GUI sounds. When I looked into my receiver it is 'stuck' into Dolby Digital. If I try to play another movie with DTS I got no sound. I did a log where I hope this behavior was captured. Here's the log: http://ix.io/3MHs I've also posted this on Libreelec Forum. And I assure you. The problem is real. And it's only getting worse. Please, let me know if the logs capture something. PS: I also own a Vero 4K (OSMC) and before this issue, there wasn't any difference between the two devices regarding this issues mentioned above. The only difference is that Vero4K still is running Kodi 19. |
Description
As part of the update to ffmpeg 4.4 the implementation of
avcodec_encode_audio2()
was changed to a compatibility wrapper aroundavcodec_send_frame()
/avcodec_receive_packet()
(See ffmpeg source v4.4 and v4.3). This now seems to require the channel count to be set according to the channel layout.A little more in-depth explanation of the problem:
Encoding failed due to the comparison right here as
src
(the frame we passed in) still haschannels
=0 whiledst
(a frame created with the exact same parameters assrc
) had it's channel count set according to the channel layout right here. Both functions are called fromav_frame_ref()
.I suspect that the same issue occurs in EncoderFFmpeg (the only other usage
avcodec_encode_audio2()
) as neitherm_ResampledFrame
orm_BufferFrame
ever havechannels
set but I don't know enough about the codebase to verify the behaviour or test the fix.Motivation and context
Fixes #20398
How has this been tested?
I tested AC3 transcoding on my NVIDIA Shield with various different files. I don't really know what else could be impacted but in any case it would probably be nice to get some people from #20398 to test on different platforms.
Types of change
Checklist: