![使用 FFMPEG 将音频与视频合并时删除视频不必要的旋转](https://linux22.com/image/1468222/%E4%BD%BF%E7%94%A8%20FFMPEG%20%E5%B0%86%E9%9F%B3%E9%A2%91%E4%B8%8E%E8%A7%86%E9%A2%91%E5%90%88%E5%B9%B6%E6%97%B6%E5%88%A0%E9%99%A4%E8%A7%86%E9%A2%91%E4%B8%8D%E5%BF%85%E8%A6%81%E7%9A%84%E6%97%8B%E8%BD%AC.png)
实际上我想使用录音机将音频文件覆盖到录制的视频文件中。为此,我正在使用FFMPEG图书馆项目来自此链接
问题: 当我在肖像模式然后将视频与录制的音频合并,合并工作正常,但问题是视频旋转 90 度,然后合并才有效。我不想旋转视频,我只想合并。
如果我以横向模式捕捉视频,那么合并音频就可以正常工作。
目前,FFMPEG 命令用于合并音频和视频文件
ffmpeg -y -i Video.mp4 -i Audio.mp4 -c:v copy -c:a copy -strict experimental -map 0:v:0 -map 1:a:0 OutputFile.mp4
我也尝试过使用下面的命令,但是没有效果
ffmpeg -y -i Video.mp4 -i Audio.mp4 -c:v copy -c:a copy -strict experimental -map 0:v:0 -map 1:a:0 -vf -metadata:s:v:0 rotate=0 OutputFile.mp4
和
ffmpeg -y -i Video.mp4 -i Audio.mp4 -c:v copy -c:a copy -strict experimental -map 0:v:0 -map 1:a:0 -vf -metadata:s:v:0 translate=1 OutputFile.mp4
我也尝试了其他可能性,但对我来说不起作用。
任何帮助都会被接受。
提前致谢
Log cat 显示如下
WARNING: linker: /data/data/com.informer.favoraid/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
ffmpeg version 0.11.1
built on Feb 7 2015 21:39:25 with gcc 4.6 20120106 (prerelease)
configuration: --arch=arm --cpu=cortex-a8 --target-os=linux --enable-runtime-cpudetect --prefix=/data/data/info.guardianproject.ffmpeg/app_opt --enable-pic --disable-shared --enable-static --cross-prefix=/home/josh/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi- --sysroot=/home/josh/android-ndk/platforms/android-16/arch-arm --extra-cflags='-I../x264 -mfloat-abi=softfp -mfpu=neon -fPIE -pie' --extra-ldflags='-L../x264 -fPIE -pie' --enable-version3 --enable-gpl --disable-doc --enable-yasm --enable-decoders --enable-encoders --enable-muxers --enable-demuxers --enable-parsers --enable-protocols --enable-filters --enable-avresample --enable-libfreetype --disable-indevs --enable-indev=lavfi --disable-outdevs --enable-hwaccels --enable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-network --enable-libx264 --enable-zlib --enable-muxer=md5
libavutil 51. 54.100 / 51. 54.100
libavcodec 54. 23.100 / 54. 23.100
libavformat 54. 6.100 / 54. 6.100
libavdevice 54. 0.100 / 54. 0.100
libavfilter 2. 77.100 / 2. 77.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Android/data/com.informer.favoraid/files/MP4_FAV20151002_105039_1099425693.mp4':
10-01 17:15:20.056: I/System.out(6526): sxCon> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
'/storage/emulated/0/Android/data/com.informer.favoraid/files/MP4_FAV20151001_171355_-1450037636.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2015-10-01 11:44:06
Duration: 00:00:04.80, start: 0.000000, bitrate: 15488 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 16004 kb/s, 29.97 fps, 30 tbr, 90k tbn, 180k tbc
Metadata:
rotate : 90
creation_time : 2015-10-01 11:44:06
handler_name : VideoHandle
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 128 kb/s
Metadata:
creation_time : 2015-10-01 11:44:06
handler_name : SoundHandle
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Android/data/com.informer.favoraid/Audio_Recording.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2015-10-01 11:45:13
Duration: 00:00:05.24, start: 0.000000, bitrate: 18 kb/s
Stream #1:0(eng): Audio: aac (mp4a / 0x6134706D), 8000 Hz, mono, s16, 12 kb/s
Metadata:
creation_time : 2015-10-01 11:45:13
handler_name : SoundHandle
Output #0, mp4, to '/storage/emulated/0/Android/data/com.informer.favoraid/OutputFile.mp4':
Metadata:
: major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2015-10-01 11:44:06
encoder : Lavf54.6.100
Stream #0:0(eng): Video: h264 (![0][0][0] / 0x0021), yuv420p, 1920x1080, q=2-31, 16004 kb/s, 29.97 fps, 90k tbn, 90k tbc
Metadata:
rotate : 90
creation_time : 2015-10-01 11:44:06
handler_name : VideoHandle
Stream #0:1(eng): Audio: aac (@[0][0][0] / 0x0040), 8000 Hz, mono, 12 kb/s
Metadata:
creation_time : 2015-10-01 11:45:13
handler_name : SoundHandle
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 138 fps=0.0 q=-1.0 Lsize= 9008kB time=00:00:04.57 bitrate=16141.8kbits/s