ChinaFFmpeg

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 7955|回复: 7

[Android] 合并多个视频

[复制链接]
黑户  发表于 2016-10-30 22:25:52 |阅读模式
过程师史,下面这个命令行直接挂掉,那里有问题?谢谢!

ffmpeg -i /storage/1477701680016.mp4 -i /storage/201628184254.mp4 -filter_complex '[0:0] [0:1] [1:0] [1:1] concat=n=2:v=1:a=1 [v] [a]' -map '[v]' -map '[a]' /storage/201630222338.mp4
回复

使用道具

黑户  发表于 2016-10-30 22:28:01
ffmpeg version 2.6.3 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.6 (GCC) 20120106 (prerelease)
  configuration: --target-os=linux --prefix=../android-lib-ff-full --enable-cross-compile --enable-runtime-cpudetect --disable-asm --arch=arm --cc=/home/leixiaohua1020/cdtworkspace/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc --cross-prefix=/home/leixiaohua1020/cdtworkspace/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi- --disable-stripping --nm=/home/leixiaohua1020/cdtworkspace/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-nm --sysroot=/home/leixiaohua1020/cdtworkspace/android-ndk-r9d/platforms/android-8/arch-arm --enable-gpl --enable-shared --disable-static --enable-nonfree --enable-version3 --enable-small --disable-vda --disable-iconv --enable-libx264 --enable-libfaac --enable-encoder=libx264 --enable-encoder=libfaac --enable-zlib --disable-ffprobe --disable-ffplay --disable-ffmpeg --disable-ffserver --disable-debug --extra-cflags='-I ../android-lib/include -fPIC -DANDROID -D__thumb__ -mthumb -Wfatal-errors -Wno-deprecated -mfloat-abi=softfp -marm -march=armv7-a' --extra-ldflags='-L ../android-lib/lib'
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 25.101 / 56. 25.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 11.102
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Splitting the commandline.
Reading option '-i' ... matched as input file with argument '/storage/emulated/0/tencent/MicroMsg/WeiXin/1477701680016.mp4'.
Reading option '-i' ... matched as input file with argument '/storage/emulated/0/watermark/201628184254.mp4'.
Reading option '-filter_complex' ... matched as option 'filter_complex' (create a complex filtergraph) with argument ''[0:0]'.
Reading option '[0:1]' ... matched as output file.
Reading option '[1:0]' ... matched as output file.
Reading option '[1:1]' ... matched as output file.
Reading option 'concat=n=2:v=1:a=1' ... matched as output file.
Reading option '[v]' ... matched as output file.
Reading option '[a]'' ... matched as output file.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument ''[v]''.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument ''[a]''.
Reading option '/storage/emulated/0/watermark/201630222338.mp4' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option filter_complex (create a complex filtergraph) with argument '[0:0].
Successfully parsed a group of options.
Parsing a group of options: input file /storage/emulated/0/tencent/MicroMsg/WeiXin/1477701680016.mp4.
Successfully parsed a group of options.
Opening an input file: /storage/emulated/0/tencent/MicroMsg/WeiXin/1477701680016.mp4.
Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
ISO: File Type Major Brand: isom
Before avformat_find_stream_info() pos: 26182 bytes read:32768 seeks:0
All info found
After avformat_find_stream_info() pos: 40441 bytes read:65536 seeks:0 frames:5
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/tencent/MicroMsg/WeiXin/1477701680016.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : 1771333873135943
    encoder         : Lavf56.40.101
  Duration: 00:00:59.69, start: 0.169000, bitrate: 309 kb/s
    Stream #0:0(und), 1, 1/90000: Video: h264 (avc1 / 0x31637661), yuv420p, 400x300 [SAR 1:1 DAR 4:3], 287 kb/s, 20 fps, 20 tbr, 90k tbn, 40 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und), 4, 1/48000: Audio: aac (HE-AACv2) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 19 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Successfully opened the file.
Parsing a group of options: input file /storage/emulated/0/watermark/201628184254.mp4.
Successfully parsed a group of options.
Opening an input file: /storage/emulated/0/watermark/201628184254.mp4.
Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
ISO: File Type Major Brand: isom
Before avformat_find_stream_info() pos: 1361061 bytes read:56779 seeks:1
no picture
All info found
After avformat_find_stream_info() pos: 12475 bytes read:89547 seeks:2 frames:4
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/watermark/201628184254.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.25.101
  Duration: 00:00:30.00, start: 0.000000, bitrate: 362 kb/s
    Stream #1:0(und), 3, 1/12288: Video: h264 (avc1 / 0x31637661), yuv420p, 360x480, 308 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #1:1(und), 1, 1/44100: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 47 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Successfully opened the file.
Parsing a group of options: output file [0:1].
Successfully parsed a group of options.
Opening an output file: [0:1].
No such filter: '[0:0]'
Error configuring filters.
CALLED CLEAN UP!!!
Statistics: 65536 bytes read, 0 seeks
Statistics: 89547 bytes read, 2 seeks
Quit at 1
回复 支持 反对

使用道具

黑户  发表于 2016-10-30 22:30:05
中括号之间的空格删除

ffmpeg -i /storage/2016102968803.mp4 -i /storage/2016102912820.mp4 -filter_complex '[0:0][0:1][1:0][1:1]concat=n=2:v=1:a=1[v][a]' -map '[v]' -map '[a]' /storage/20163022294.mp4
回复 支持 反对

使用道具

黑户  发表于 2016-10-30 22:30:48
ffmpeg version 2.6.3 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.6 (GCC) 20120106 (prerelease)
  configuration: --target-os=linux --prefix=../android-lib-ff-full --enable-cross-compile --enable-runtime-cpudetect --disable-asm --arch=arm --cc=/home/leixiaohua1020/cdtworkspace/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc --cross-prefix=/home/leixiaohua1020/cdtworkspace/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi- --disable-stripping --nm=/home/leixiaohua1020/cdtworkspace/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-nm --sysroot=/home/leixiaohua1020/cdtworkspace/android-ndk-r9d/platforms/android-8/arch-arm --enable-gpl --enable-shared --disable-static --enable-nonfree --enable-version3 --enable-small --disable-vda --disable-iconv --enable-libx264 --enable-libfaac --enable-encoder=libx264 --enable-encoder=libfaac --enable-zlib --disable-ffprobe --disable-ffplay --disable-ffmpeg --disable-ffserver --disable-debug --extra-cflags='-I ../android-lib/include -fPIC -DANDROID -D__thumb__ -mthumb -Wfatal-errors -Wno-deprecated -mfloat-abi=softfp -marm -march=armv7-a' --extra-ldflags='-L ../android-lib/lib'
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 25.101 / 56. 25.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 11.102
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Splitting the commandline.
Reading option '-i' ... matched as input file with argument '/storage/emulated/0/watermark/2016102968803.mp4'.
Reading option '-i' ... matched as input file with argument '/storage/emulated/0/watermark/2016102912820.mp4'.
Reading option '-filter_complex' ... matched as option 'filter_complex' (create a complex filtergraph) with argument ''[0:0][0:1][1:0][1:1]concat=n=2:v=1:a=1[v][a]''.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument ''[v]''.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument ''[a]''.
Reading option '/storage/emulated/0/watermark/20163022294.mp4' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option filter_complex (create a complex filtergraph) with argument '[0:0][0:1][1:0][1:1]concat=n=2:v=1:a=1[v][a]'.
Successfully parsed a group of options.
Parsing a group of options: input file /storage/emulated/0/watermark/2016102968803.mp4.
Successfully parsed a group of options.
Opening an input file: /storage/emulated/0/watermark/2016102968803.mp4.
Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
ISO: File Type Major Brand: isom
Before avformat_find_stream_info() pos: 875193 bytes read:44186 seeks:1
All info found
After avformat_find_stream_info() pos: 10935 bytes read:76954 seeks:2 frames:26
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/watermark/2016102968803.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : 1771333873135943
    encoder         : Lavf56.25.101
  Duration: 00:00:25.00, start: 0.024000, bitrate: 280 kb/s
    Stream #0:0(und), 1, 1/90000: Video: h264 (avc1 / 0x31637661), yuv420p, 400x300 [SAR 1:1 DAR 4:3], 267 kb/s, 20 fps, 20 tbr, 90k tbn, 40 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und), 25, 1/48000: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 19 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Successfully opened the file.
Parsing a group of options: input file /storage/emulated/0/watermark/2016102912820.mp4.
Successfully parsed a group of options.
Opening an input file: /storage/emulated/0/watermark/2016102912820.mp4.
Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
ISO: File Type Major Brand: isom
Before avformat_find_stream_info() pos: 1336220 bytes read:47802 seeks:1
All info found
After avformat_find_stream_info() pos: 14307 bytes read:80570 seeks:2 frames:5
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/watermark/2016102912820.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : 1771333873135943
    encoder         : Lavf56.25.101
  Duration: 00:00:33.02, start: 0.000000, bitrate: 323 kb/s
    Stream #1:0(und), 1, 1/90000: Video: h264 (avc1 / 0x31637661), yuv420p, 400x300 [SAR 1:1 DAR 4:3], 301 kb/s, 20 fps, 20 tbr, 90k tbn, 40 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #1:1(und), 4, 1/48000: Audio: aac (HE-AACv2) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 20 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Successfully opened the file.
Parsing a group of options: output file /storage/emulated/0/watermark/20163022294.mp4.
Applying option map (set input stream mapping) with argument '[v]'.
Invalid stream specifier: '[v]'.
Invalid stream specifier: '[v]'.
Invalid stream specifier: '[v]'.
Invalid stream specifier: '[v]'.
Stream map ''[v]'' matches no streams.
CALLED CLEAN UP!!!
Statistics: 76954 bytes read, 2 seeks
Statistics: 80570 bytes read, 2 seeks
Quit at 1
回复 支持 反对

使用道具

黑户  发表于 2016-10-30 22:34:22
合并不同编码的视频文件,我的语法哪里有问题,过程师兄弟给个例子,谢谢!
回复 支持 反对

使用道具

发表于 2016-10-31 09:39:33 | 显示全部楼层
不同编码的话,最好改成相同编码然后合并
回复 支持 反对

使用道具 举报

黑户  发表于 2016-10-31 09:51:16
感谢大师兄弟, 那就得搜索一下每个视频的编码方式, 然后全部转码成最长的那个视频的编码, 再合并。

另外,我就照着下面的语言写的,
https://ffmpeg.org/ffmpeg-filters.html#Examples-99

怎么老说我各种错误? 能帮我写一个能运行的例子吗?
Invalid stream specifier: '[v]'.
Invalid stream specifier: '[v]'.
Invalid stream specifier: '[v]'.
Invalid stream specifier: '[v]'.
回复 支持 反对

使用道具

发表于 2016-10-31 10:22:11 | 显示全部楼层
转码后,直接用concat的format应该就可以咯
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|Archiver|ChinaFFmpeg

GMT+8, 2024-12-27 13:48 , Processed in 0.054519 second(s), 14 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表