kivy / kivy/python-for-android
bug: recipes: ffmpeg: hardware acc flags override --disable-everything flag
- Ngôn ngữ chính
- Python
- Star
- 8.9k
- Fork
- 2k
- Merge trung bình
- 12 giờ 20 phút
- Pull request đã merge (30 ngày)
- 9
Mô tả
The ffmpeg recipe declares `flags = ['--disable-everything']` but then right below it
overrides the flags again (instead of appending):
https://github.com/kivy/python-for-android/blob/e772ad93f20a61c0bbe1cf8955e073cfb41062e1/pythonforandroid/recipes/ffmpeg/__init__.py#L39-L47
The obvious fix is simple, but i have no means of testing the actual recipe, so I won't open a PR. Someone who is actually using this ffmpeg recipe should be testing the fix.
My LLM also recommends a patch like this to keep the hardware acceleration functional after this change:
Click to show patch:
```patch
diff --git a/pythonforandroid/recipes/ffmpeg/__init__.py b/pythonforandroid/recipes/ffmpeg/__init__.py
index 24004868..33724ee2 100644
--- a/pythonforandroid/recipes/ffmpeg/__init__.py
+++ b/pythonforandroid/recipes/ffmpeg/__init__.py
@@ -98,10 +98,18 @@ class FFMpegRecipe(Recipe):
else:
# Enable codecs only for .mp4:
flags += [
- '--enable-parser=aac,ac3,h261,h264,mpegaudio,mpeg4video,mpegvideo,vc1',
- '--enable-decoder=aac,h264,mpeg4,mpegvideo',
+ '--enable-parser=aac,ac3,h261,h264,hevc,mpegaudio,mpeg4video,mpegvideo,vc1',
+ '--enable-decoder=aac,h264,hevc,mpeg4,mpegvideo',
+ # --enable-mediacodec only builds the MediaCodec support layer;
+ # the hardware decoders are separate components that
+ # --disable-everything switches off, so enable them explicitly.
+ # They are never picked automatically -- avcodec_find_decoder()
+ # returns the first match in list order and every software
+ # decoder is declared first -- so callers ask for them by name
+ # and the software decoders above stay as the fallback.
+ '--enable-decoder=h264_mediacodec,hevc_mediacodec,mpeg4_mediacodec,mpeg2_mediacodec',
'--enable-muxer=h264,mov,mp4,mpeg2video',
- '--enable-demuxer=aac,h264,m4v,mov,mpegvideo,vc1,rtsp',
+ '--enable-demuxer=aac,h264,hevc,m4v,mov,mpegvideo,vc1,rtsp',
]
# needed to prevent _ffmpeg.so: version node not found for symbol av_init_packet@LIBAVFORMAT_52
```
It also mentions the following issues after reviewing this change:
1. The shipped ffmpeg CLI loses all encoders. --enable-encoders appears only at line 94, inside the ffpyplayer_codecs/av_codecs branch. The minimal branch enables muxers and zero encoders. build_arch ends with cp ffmpeg ./lib/libffmpegbin.so (added 2026-01-19, #3276 — after the #3092 bug), so that binary has only ever existed in "everything enabled" form. Post-fix it can remux but any -c:v/-c:a fails with "Unknown encoder".
2. HLS breaks. --enable-protocol=...,hls builds hlsproto.c (deprecated, handles hls+http://). Real playback needs the hls demuxer — ff_hls_demuxer is a distinct component, it's not in the demuxer list, and hls_demuxer_select additionally requires mpegts_demuxer aac_demuxer ac3_demuxer eac3_demuxer, none enabled.
3. RTSP breaks. rtsp_demuxer_select="http_protocol rtpdec" (configure:3682) — it does not pull rtp_protocol, and the protocol list is file,http,hls,udp,tcp with no rtp. Result: Protocol not found.
Also real but lower-stakes: mp4 audio is aac-only (mp3/ac3/alac tracks decode to nothing), and should_build() returns early on an existing libavcodec.so, so nobody sees any of this without a clean build.
According to the git blame this was introduced in https://github.com/kivy/python-for-android/pull/3092 by @DexerBR, maybe @DexerBR has some way of testing a fix.
Hướng dẫn đóng góp
Hướng nghiên cứu
Start in pythonforandroid/recipes/ffmpeg/__init__.py, especially the flag setup around lines 39-47 and the ffpyplayer_codecs/av_codecs branch near line 94. Read build_arch and should_build() to understand how a clean recipe build produces the shipped binary, then verify the relevant CLI, HLS, and RTSP behavior. Done means the disable flags and hardware acceleration remain compatible without losing the required codecs or protocols.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- android, python
- Lĩnh vực
- build-system, mobile
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 48/100