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

[Bug]: FFMPEG transcoding with mediacodec first keyframe missing or damaged after ffmpeg update #22899

Open
osts opened this issue Jan 11, 2025 · 0 comments
Labels
bug report Something is not working properly untriaged

Comments

@osts
Copy link

osts commented Jan 11, 2025

Problem description

FFMPEG transcoding of 4K x264 video to x265(hevc) with mediacodec hardware acceleration first video file keyframe is missing or damaged after ffmpeg update to version 7.1-1 . The video file is usable after the next keyframe(GOP). Transcoding is performed with Orange PI 5 plus device based on Rockchip RK3588 processor and running on Android 12. Thanks to the availability of another Android device with termux and an older ffmpeg by making a backup and restoring it on an Orange PI I recovered a version of ffmpeg that works. This version of ffmpeg is 6.1.2. I transcoding video from the sftp server and put back transcoded video to this sftp server. Termux command is:

ffmpeg -c:v h264_mediacodec -i sftp://user:pass@10.0.0.21:2122/128GB_SD3/Lietuva/VID_20230809_194129.mp4 -map 0:v -c:v hevc_mediacodec -bitrate_mode 1 -b:v 32000k -pix_fmt nv12 -g 180 -map 0:a -c:a:0 copy sftp://user:pass@10.0.0.21:2122/DATA_D/foto/Lietuva/034_Vilna_0908_2023_30.mp4

I used Orange PI with termux for transcoding of video, because transcoded video quality is way better than transcoded with NVIDIA or AMD hardware acceleration. I noticed, that ffmpeg7.1-1 hardware transcoding performs much faster than ffmpeg 6.1.2 , but first keyframe problem prevents me to use it. I would be very happy if I could get a working ffmpeg 7 version for termux, without this unpleasant artifact.

What steps will reproduce the bug?

Run transcode with ffmpeg 7.1-1 on termux

ffmpeg -c:v h264_mediacodec -i sftp://user:pass@10.0.0.21:2122/128GB_SD3/Lietuva/VID_20230809_194129.mp4 -map 0:v -c:v hevc_mediacodec -bitrate_mode 1 -b:v 32000k -pix_fmt nv12 -g 180 -map 0:a -c:a:0 copy sftp://user:pass@10.0.0.21:2122/DATA_D/foto/Lietuva/034_Vilna_0908_2023_30.mp4

What is the expected behavior?

Transcoded video with normal first keyframe, same as with ffmpeg 6.1.2

System information

Termux Variables:
TERMUX_EXEC__PROC_SELF_EXE=/data/data/com.termux/files/usr/bin/termux-info
TERMUX_VERSION=googleplay.2024.10.30
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://termux.net stable main
Updatable packages:
apt/stable 2.9.21 aarch64 [upgradable from: 2.9.10]
command-not-found/stable 2.4.0-57 aarch64 [upgradable from: 2.4.0-48]
curl/stable 8.11.1 aarch64 [upgradable from: 8.10.1-2]
debianutils/stable 5.21 aarch64 [upgradable from: 5.20]
ed/stable 1.21 aarch64 [upgradable from: 1.20.2]
ffmpeg/stable 7.1-1 aarch64 [upgradable from: 6.1.2]
glib/stable 2.82.4 aarch64 [upgradable from: 2.82.2]
harfbuzz/stable 10.1.0-1 aarch64 [upgradable from: 10.0.1]
inetutils/stable 2.5 aarch64 [upgradable from: 2.4-2]
less/stable 668 aarch64 [upgradable from: 661]
libaom/stable 3.11.0 aarch64 [upgradable from: 3.10.0]
libc++/stable 27c aarch64 [upgradable from: 27b]
libcurl/stable 8.11.1 aarch64 [upgradable from: 8.10.1-2]
libexpat/stable 2.6.4 aarch64 [upgradable from: 2.6.3]
libjpeg-turbo/stable 3.1.0 aarch64 [upgradable from: 3.0.4]
libltdl/stable 2.5.4 aarch64 [upgradable from: 2.5.3]
libnghttp3/stable 1.7.0 aarch64 [upgradable from: 1.6.0]
libopenmpt/stable 0.7.13 aarch64 [upgradable from: 0.7.11]
libpixman/stable 0.44.2 aarch64 [upgradable from: 0.43.4]
librav1e/stable 0.7.1-2 aarch64 [upgradable from: 0.7.1-1]
libsmartcols/stable 2.40.2-2 aarch64 [upgradable from: 2.40.2-1]
libsrt/stable 1.5.4 aarch64 [upgradable from: 1.5.3]
libssh/stable 0.11.1 aarch64 [upgradable from: 0.10.6]
libvpx/stable 1:1.15.0-1 aarch64 [upgradable from: 1:1.15.0]
libwebp/stable 1.5.0 aarch64 [upgradable from: 1.4.0-rc1-0]
libx265/stable 4.1 aarch64 [upgradable from: 3.5-p20230222-0]
libxau/stable 1.0.12 aarch64 [upgradable from: 1.0.11]
libxml2/stable 2.13.5 aarch64 [upgradable from: 2.13.4-1]
libxrender/stable 0.9.12 aarch64 [upgradable from: 0.9.11]
mpg123/stable 1.32.10 aarch64 [upgradable from: 1.32.9]
nano/stable 8.3 aarch64 [upgradable from: 8.2]
util-linux/stable 2.40.2-2 aarch64 [upgradable from: 2.40.2-1]
xxhash/stable 0.8.3 aarch64 [upgradable from: 0.8.2]
termux-tools version:
3.0.8
Android version:
12
Kernel build information:
Linux localhost 5.10.160 #15 SMP PREEMPT Wed Oct 18 16:12:23 CST 2023 aarch64 Android
Device manufacturer:
rockchip
Device model:
orangepi5plus
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
@osts osts added bug report Something is not working properly untriaged labels Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Something is not working properly untriaged
Projects
None yet
Development

No branches or pull requests

1 participant