Я вже використовую ffmpeg для приєднання до 2-х файлів, але є певна проблема, друге відео, можливо, має інший вимір, тому отримайте деяку помилку під час перетворення:
Команда:
ffmpeg -i introlq.mp4 -i lq1.mp4 -filter_complex "[0:0] [0:1] [1:0] [1:1] concat=n=2:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" output.mp4
Результат:
ffmpeg -i introlq.mp4 -i lq1.mp4 -filter_complex "[0:0] [0
:1] [1:0] [1:1] concat=n=2:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" output.mp4
ffmpeg version N-67838-g4388e78 Copyright (c) 2000-2014 the FFmpeg developers
built on Nov 19 2014 22:11:54 with gcc 4.9.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-lib
modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrw
b --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge
r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --en
able-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
libx265 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 54. 14.100 / 54. 14.100
libavcodec 56. 12.101 / 56. 12.101
libavformat 56. 14.100 / 56. 14.100
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 2.103 / 5. 2.103
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'introlq.mp4':
Metadata:
major_brand : mp42
minor_version : 18743402
compatible_brands: mp42isom
creation_time : 2014-11-22 01:17:30
Duration: 00:00:06.13, start: 0.000000, bitrate: 218 kb/s
Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, stereo, flt
p, 31 kb/s (default)
Metadata:
creation_time : 2014-11-22 01:17:30
handler_name : Sound Media Handler
Stream #0:1(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 320x1
82 [SAR 1:1 DAR 160:91], 182 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc (default)
Metadata:
creation_time : 2014-11-22 01:17:30
handler_name : Video Media Handler
encoder : AVC Coding
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'lq1.mp4':
Metadata:
major_brand : 3gp6
minor_version : 256
compatible_brands: isom3gp6
creation_time : 2014-11-11 21:41:38
Duration: 00:01:50.11, start: 0.000000, bitrate: 229 kb/s
Stream #1:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p
, 320x182 [SAR 1:1 DAR 160:91], 195 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc (defaul
t)
Metadata:
creation_time : 2014-11-11 21:41:38
handler_name : IsoMedia File Produced by Google, 5-11-2011
Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, mono, fltp,
31 kb/s (default)
Metadata:
creation_time : 2014-11-11 21:41:38
handler_name : IsoMedia File Produced by Google, 5-11-2011
Stream specifier ':0' in filtergraph description [0:0] [0:1] [1:0] [1:1] concat=
n=2:v=1:a=1 [v] [a] matches no streams.
До речі, якщо хтось знає кращий спосіб приєднати 2 файли, будь ласка, дайте мені знати.
перший результат:
ffmpeg -i IntLQ.mp4 -i V-LQ.mp4 -filter_c
omplex "[0:0][0:1][1:1][1:0]concat=n=2:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" o
utput.mp4
ffmpeg version N-67838-g4388e78 Copyright (c) 2000-2014 the FFmpeg developers
built on Nov 19 2014 22:11:54 with gcc 4.9.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-lib
modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrw
b --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge
r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --en
able-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
libx265 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 54. 14.100 / 54. 14.100
libavcodec 56. 12.101 / 56. 12.101
libavformat 56. 14.100 / 56. 14.100
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 2.103 / 5. 2.103
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'IntLQ.mp4':
Metadata:
major_brand : mp42
minor_version : 18743402
compatible_brands: mp42isom
creation_time : 2014-12-18 06:17:37
Duration: 00:00:04.07, start: 0.000000, bitrate: 317 kb/s
Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, flt
p, 127 kb/s (default)
Metadata:
creation_time : 2014-12-18 06:17:37
handler_name : Sound Media Handler
Stream #0:1(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv), 3
20x210 [SAR 1:1 DAR 32:21], 185 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (
default)
Metadata:
creation_time : 2014-12-18 06:17:37
handler_name : Video Media Handler
encoder : AVC Coding
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'V-LQ.mp4':
Metadata:
major_brand : 3gp6
minor_version : 256
compatible_brands: isom3gp6
creation_time : 2014-12-17 13:48:14
Duration: 00:00:57.07, start: 0.000000, bitrate: 220 kb/s
Stream #1:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p
, 320x180 [SAR 1:1 DAR 16:9], 186 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc (default)
Metadata:
creation_time : 2014-12-17 13:48:14
handler_name : IsoMedia File Produced by Google, 5-11-2011
Stream #1:1(fre): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, mono, fltp,
31 kb/s (default)
Metadata:
creation_time : 2014-12-17 13:48:15
handler_name : IsoMedia File Produced by Google, 5-11-2011
Stream specifier ':0' in filtergraph description [0:0][0:1][1:1][1:0]concat=n=2:
v=1:a=1 [v] [a] matches no streams.
другий результат:
ffmpeg -i IntLQ.mp4 -i V-LQ.mp4 -filter_c
omplex "[0:0]anull[a1]; [0:1]null[v1]; [1:0]null[v2]; [1:1]anull[a2]; [a1][v1][a
2][v2]concat=n=2:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" output.mp4
ffmpeg version N-67838-g4388e78 Copyright (c) 2000-2014 the FFmpeg developers
built on Nov 19 2014 22:11:54 with gcc 4.9.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-lib
modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrw
b --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge
r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --en
able-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
libx265 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 54. 14.100 / 54. 14.100
libavcodec 56. 12.101 / 56. 12.101
libavformat 56. 14.100 / 56. 14.100
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 2.103 / 5. 2.103
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'IntLQ.mp4':
Metadata:
major_brand : mp42
minor_version : 18743402
compatible_brands: mp42isom
creation_time : 2014-12-18 06:17:37
Duration: 00:00:04.07, start: 0.000000, bitrate: 317 kb/s
Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, flt
p, 127 kb/s (default)
Metadata:
creation_time : 2014-12-18 06:17:37
handler_name : Sound Media Handler
Stream #0:1(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv), 3
20x210 [SAR 1:1 DAR 32:21], 185 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (
default)
Metadata:
creation_time : 2014-12-18 06:17:37
handler_name : Video Media Handler
encoder : AVC Coding
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'V-LQ.mp4':
Metadata:
major_brand : 3gp6
minor_version : 256
compatible_brands: isom3gp6
creation_time : 2014-12-17 13:48:14
Duration: 00:00:57.07, start: 0.000000, bitrate: 220 kb/s
Stream #1:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p
, 320x180 [SAR 1:1 DAR 16:9], 186 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc (default)
Metadata:
creation_time : 2014-12-17 13:48:14
handler_name : IsoMedia File Produced by Google, 5-11-2011
Stream #1:1(fre): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, mono, fltp,
31 kb/s (default)
Metadata:
creation_time : 2014-12-17 13:48:15
handler_name : IsoMedia File Produced by Google, 5-11-2011
[Parsed_anull_0 @ 00000000049abc80] Media type mismatch between the 'Parsed_anul
l_0' filter output pad 0 (audio) and the 'Parsed_concat_4' filter input pad 0 (v
ideo)
[AVFilterGraph @ 00000000046d0760] Cannot create the link anull:0 -> concat:0
Error configuring filters.
відредагований результат:
ffmpeg -i IntLQ.mp4 -i V-LQ.mp4 -filter_c
omplex "[0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" o
utput.mp4
ffmpeg version N-67838-g4388e78 Copyright (c) 2000-2014 the FFmpeg developers
built on Nov 19 2014 22:11:54 with gcc 4.9.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-lib
modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrw
b --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge
r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --en
able-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
libx265 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 54. 14.100 / 54. 14.100
libavcodec 56. 12.101 / 56. 12.101
libavformat 56. 14.100 / 56. 14.100
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 2.103 / 5. 2.103
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'IntLQ.mp4':
Metadata:
major_brand : mp42
minor_version : 18743402
compatible_brands: mp42isom
creation_time : 2014-12-18 06:17:37
Duration: 00:00:04.07, start: 0.000000, bitrate: 317 kb/s
Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, flt
p, 127 kb/s (default)
Metadata:
creation_time : 2014-12-18 06:17:37
handler_name : Sound Media Handler
Stream #0:1(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv), 3
20x210 [SAR 1:1 DAR 32:21], 185 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (
default)
Metadata:
creation_time : 2014-12-18 06:17:37
handler_name : Video Media Handler
encoder : AVC Coding
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'V-LQ.mp4':
Metadata:
major_brand : 3gp6
minor_version : 256
compatible_brands: isom3gp6
creation_time : 2014-12-17 13:48:14
Duration: 00:00:57.07, start: 0.000000, bitrate: 220 kb/s
Stream #1:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p
, 320x180 [SAR 1:1 DAR 16:9], 186 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc (default)
Metadata:
creation_time : 2014-12-17 13:48:14
handler_name : IsoMedia File Produced by Google, 5-11-2011
Stream #1:1(fre): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, mono, fltp,
31 kb/s (default)
Metadata:
creation_time : 2014-12-17 13:48:15
handler_name : IsoMedia File Produced by Google, 5-11-2011
[Parsed_concat_0 @ 0000000004b4ef00] Input link in1:v0 parameters (size 320x180,
SAR 1:1) do not match the corresponding output link in0:v0 parameters (320x210,
SAR 1:1)
[Parsed_concat_0 @ 0000000004b4ef00] Failed to configure output pad on Parsed_co
ncat_0
[0:0][0:1][1:1][1:0] Concat
але, як я вже згадував, я використовую нульові фільтри як міру безпеки - я розумію, що це може бути зайвим. Можливо, я міг би це відредагувати.