gpt4 book ai didi

android - ffmpeg concat 视频在 Android 上失败

转载 作者:行者123 更新时间:2023-11-29 19:35:19 24 4
gpt4 key购买 nike

我正在使用 this将 ffmpeg 集成到我的 android 应用程序的库。

我能够使用库成功裁剪视频,但现在我需要连接两个分辨率完全相同的视频。

我使用的ffmpeg命令是

-i input1.mp4 -i input2.mp4 -filter_complex concat=n=2:v=1:a=1 -f MP4 out.mp4

当我在这 2 个视频上运行该命令时出现上述错误


ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8 (GCC)
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/DCIM/CameraDemo/1.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2016-09-02 10:17:23
com.android.version: 7.0
Duration: 00:00:04.46, start: 0.000000, bitrate: 6078 kb/s
Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuvj420p(pc, bt470bg/bt470bg/smpte170m), 720x480, 6010 kb/s, SAR 1:1 DAR 3:2, 30 fps, 30 tbr, 90k tbn, 180k tbc (default)
Metadata:
rotate : 270
creation_time : 2016-09-02 10:17:23
handler_name : VideoHandle
Side data:
displaymatrix: rotation of 90.00 degrees
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 96 kb/s (default)
Metadata:
creation_time : 2016-09-02 10:17:23
handler_name : SoundHandle
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/DCIM/CameraDemo/1.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2016-09-02 10:17:23
com.android.version: 7.0
Duration: 00:00:04.46, start: 0.000000, bitrate: 6078 kb/s
Stream #1:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuvj420p(pc, bt470bg/bt470bg/smpte170m), 720x480, 6010 kb/s, SAR 1:1 DAR 3:2, 30 fps, 30 tbr, 90k tbn, 180k tbc (default)
Metadata:
rotate : 270
creation_time : 2016-09-02 10:17:23
handler_name : VideoHandle
Side data:
displaymatrix: rotation of 90.00 degrees
Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 96 kb/s (default)
Metadata:
creation_time : 2016-09-02 10:17:23
handler_name : SoundHandle
Cannot find a matching stream for unlabeled input pad 4 on filter Parsed_concat_0

edit 1: Fixin the n=3 to n=2 changed the error message to Filter concat:out:v0 has a unconnected output

最佳答案

n 值错误。您只有两个输入。

-i input1.mp4 -i input2.mp4 -filter_complex concat=n=2:v=1:a=1 -f MP4 out.mp4

此外,如果 ffmpeg 提示映射,请使用

-filter_complex "[0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1[v][a]" -map [v] -map [a] out.mp4

关于android - ffmpeg concat 视频在 Android 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39290416/

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