使用FFMPEG将音频与视频合并时,删除不需要的视频旋转

时间:2015-10-01 11:53:06

标签: android audio ffmpeg video-capture video-processing

其实我想用录音机音频文件覆盖音频到录制的视频文件中。因为我正在使用来自this Link 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    

1 个答案:

答案 0 :(得分:1)

这不是确切的答案。在使用前后摄像头拍摄视频时,您可以找到角度并根据角度执行ffmpeg命令...请参阅此链接,您将获得一些想法 Rotating videos with FFmpeg

http://androidwarzone.blogspot.in/2011/12/ffmpeg4android.html