gpt4 book ai didi

android - Android 的 FFMPEG 格式设置

转载 作者:行者123 更新时间:2023-12-04 23:27:32 27 4
gpt4 key购买 nike

String[] args = {
"-i" ,
path,
"-codec:v",
"libx264",
"-profile:v",
"high",
"-preset",
"slow",
"-b:v",
"500k",
"-maxrate",
"500k",
"-bufsize",
"1000k",
"-vf",
"scale=-1:480",
"-threads",
"0",
"/storage/emulated/0/Download/testing.mp4"
};

这是我想要的格式。它适用于某些视频。但它失败了。

错误代码(不知道为什么它被标记出来)
configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
libavutil 55. 17.103 / 55. 17.103
libavcodec 57. 24.102 / 57. 24.102
libavformat 57. 25.100 / 57. 25.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 31.100 / 6. 31.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Download/big_buck_bunny_720p_50mb.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.24.2
Duration: 00:04:41.90, start: 0.000000, bitrate: 1488 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1100 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 383 kb/s (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : SoundHandler
[libx264 @ 0xf70c4800] width not divisible by 2 (853x480)
Output #0, mp4, to '/storage/emulated/0/Download/testing.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf53.24.2
Stream #0:0(und): Video: h264, none, q=2-31, 128 kb/s, SAR 2560:2559 DAR 0:0, 25 fps (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
encoder : Lavc57.24.102 libx264
Stream #0:1(und): Audio: aac, 0 channels, 128 kb/s (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : SoundHandler
encoder : Lavc57.24.102 aac
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

正如我得到它。它提示 [libx264 @ 0xf70c4800] width not divisible by 2 (853x480)我不知道如何解决这个问题,以便每个视频都能正常工作。

我的格式设置灵感来自:
https://www.virag.si/2012/01/web-video-encoding-tutorial-with-ffmpeg-0-9/

有没有人对我应该做些什么来解决这个问题有任何提示。

最佳答案

在此线程/帖子上找到了解决方案

https://superuser.com/questions/571141/ffmpeg-avconv-force-scaled-output-to-be-divisible-by-2

我得到的解决方案来自 Fernando Piancastelli。 (归功于他)
将缩放更改为 -vf scale="trunc(oh*a/2)*2:480"解决了一切

关于android - Android 的 FFMPEG 格式设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38556996/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com