Bug 6006

Summary: Handbrake doesn't transfer sound with encavcodecaudio: avcodec_send_frame failed
Product: Fedora Reporter: Eric L. <ewl+rpmfusion+2016>
Component: HandBrakeAssignee: Dominik 'Rathann' Mierzejewski <dominik>
Status: RESOLVED FIXED    
Severity: normal CC: akostadinov, leigh123linux, negativo17
Priority: P1    
Version: f34   
Hardware: x86_64   
OS: GNU/Linux   
namespace:
Attachments: Activity log for two encoding runs

Description Eric L. 2021-05-29 10:07:57 CEST
I'm hit by the issue described at https://www.reddit.com/r/handbrake/comments/mzcegp/encavcodecaudio_avcodec_send_frame_failed/
It seems to be due to HandBrake not supporting ffmpeg 4.4

As I can't downgrade ffmpeg, I can't currently encode films under Fedora 34, hence the high severity.

$ rpm -qa | grep -i -e ffmpeg -e HandBrake
ffmpeg-libs-4.4-2.fc34.x86_64
ffmpeg-4.4-2.fc34.x86_64
compat-ffmpeg28-2.8.17-4.fc34.x86_64
HandBrake-gui-1.3.3-11.fc34.x86_64

Activity log extract, and the resulting extracted video has no sound track (tried twice, same result):

[09:29:34] sync: first pts video is 0
[09:29:34] sync: "Chapter 1" (1) at frame 1 time 0
[09:29:34] sync: first pts audio 0x81bd is 0
[09:29:34] encavcodecaudio: avcodec_send_frame failed
[09:29:34] sync: first pts audio 0x80bd is 0
[09:29:34] encavcodecaudio: avcodec_send_frame failed
[...]
[09:38:24] encavcodecaudio: avcodec_send_frame failed
[09:38:24] sync: "Chapter 10" (10) at frame 66885 time 240782400
[09:38:24] encavcodecaudio: avcodec_send_frame failed
[...]
[09:47:41] encavcodecaudio: avcodec_send_frame failed
[09:47:42] work: average encoding speed for job is 121.068634 fps
Comment 1 Eric L. 2021-05-29 10:10:09 CEST
Created attachment 2306 [details]
Activity log for two encoding runs
Comment 3 Dominik 'Rathann' Mierzejewski 2021-05-31 00:45:42 CEST
Thanks for finding the relevant commit upstream, Leigh. I'm testing the fix and will submit builds with it soon.
Comment 4 Dominik 'Rathann' Mierzejewski 2021-05-31 23:07:28 CEST
Ok, bug reproduced and fix confirmed. Builds are underway. This should be fixed in 1.3.3-12 on F34 and rawhide.
Comment 5 Dominik 'Rathann' Mierzejewski 2021-06-03 21:48:02 CEST
HandBrake-1.3.3-12.fc34 was pushed to updates-testing.
Comment 6 leigh scott 2021-06-09 21:03:32 CEST
Fix pushed to stable.
Comment 7 Aleksandar Kostadinov 2021-06-16 20:54:29 CEST
Guys, Thanks for the fix. I wonder if you are aware of the developer comment:

https://forum.handbrake.fr/viewtopic.php?p=196805#p196805

> Note, HandBrake ships ffmpeg statically linked in, so if your version of HandBrake is using system ffmpeg, then it's blacklisted build and shouldn't be used as it'll also be missing all our patches for ffmpeg so other functionality will also be broken regardless.

So I guess it would be better to compile ffmpeg coming with project instead of using shared library.
Comment 8 leigh scott 2021-06-16 21:42:35 CEST
(In reply to Aleksandar Kostadinov from comment #7)
> Guys, Thanks for the fix. I wonder if you are aware of the developer comment:
> 
> https://forum.handbrake.fr/viewtopic.php?p=196805#p196805
> 
> > Note, HandBrake ships ffmpeg statically linked in, so if your version of HandBrake is using system ffmpeg, then it's blacklisted build and shouldn't be used as it'll also be missing all our patches for ffmpeg so other functionality will also be broken regardless.
> 
> So I guess it would be better to compile ffmpeg coming with project instead
> of using shared library.

Are the patches rough hacks to make up for their dodgy coding?
If their patches were any good they would be in upstream ffmpeg.
Comment 9 Aleksandar Kostadinov 2021-06-16 21:57:02 CEST
If they rely on the patches, then it doesn't matter if they are rough hacks or not. We end up with an unsupported HandBrake.
Comment 10 leigh scott 2021-06-16 22:18:47 CEST
(In reply to Aleksandar Kostadinov from comment #9)
> If they rely on the patches, then it doesn't matter if they are rough hacks
> or not. We end up with an unsupported HandBrake.

This is the way.

https://github.com/rpmfusion/HandBrake/blame/master/HandBrake.spec#L68

It was fedora policy not to bundle libs that were already packaged.

Perhaps you could use upstream handbrake package or flatpak if your not happy with the way it's done.
Comment 11 Aleksandar Kostadinov 2021-06-16 22:44:44 CEST
Must rpmfusion follow all the rules? At the end this is not the same library but a similar library to original ffmpeg.

But flatpak is a nice option. I always forget about it.