1

Я знаю, что кажется, что это ответ, но я не могу объединить два аудиофайла и одно видео.

Моя команда:

ffmpeg -i file.mp4 -i file.aac -i file.mp3 -itsoffset 4 -i file_1.mov -itsoffset 10 -i file_2.mov -filter_complex "[0:v][3:v] overlay=10:main_h-overlay_h-10:enable=between(t\,4\,7) [v]; [v][4:v] overlay=10:main_h-overlay_h-10:enable=between(t\,10\,13) [v1]" -map "[v1]" -map 1:a -map 2:a -c:v libx264 -c:a libfdk_acc -shortest -y test.mp4

Ffmpeg правильно создает новый файл с оверлеями, но он не добавляет две звуковые дорожки, только одну. Чтобы уточнить, я хочу взять видео с первого входа, который имеет только одну дорожку видео, и аудио из файла aac и mp3. В чем моя ошибка?

Это мой полный вывод на консоль:

ffmpeg -i file.mp4 -i file.aac -i file.mp3 -itsoffset 4 -i file_1.mov -itsoffset 10 -i file_1.mov -filter_complex "[0:v][3:v] overlay=10:main_h-overlay_h-10:enable=between(t\,4\,7) [v]; [v][4:v] overlay=10:main_h-overlay_h-10:enable=between(t\,10\,13) [v1]" -map "[v1]" -map 1:a -map 2:a -c copy -c:v libx264 -c:a libfdk_aac -shortest -y test.mp4
ffmpeg version 2.3.git Copyright (c) 2000-2014 the FFmpeg developers
  built on Aug  7 2014 18:14:20 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --prefix=/home/stuzzo/ffmpeg_build --extra-cflags=-I/home/stuzzo/ffmpeg_build/include --extra-ldflags=-L/home/stuzzo/ffmpeg_build/lib --bindir=/home/stuzzo/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-nonfree
  libavutil      52. 98.100 / 52. 98.100
  libavcodec     55. 72.102 / 55. 72.102
  libavformat    55. 51.101 / 55. 51.101
  libavdevice    55. 13.102 / 55. 13.102
  libavfilter     4. 11.102 /  4. 11.102
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: mp41mp42isom
    creation_time   : 2014-08-27 12:22:03
  Duration: 00:00:43.65, start: 0.000000, bitrate: 698 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 568x320, 695 kb/s, 24.01 fps, 24 tbr, 600 tbn, 1200 tbc (default)
    Metadata:
      rotate          : 90
      creation_time   : 2014-08-27 12:22:03
      handler_name    : Core Media Video
    Side data:
      displaymatrix: rotation of -90.00 degrees
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'file.aac':
  Metadata:
    major_brand     : M4A 
    minor_version   : 0
    compatible_brands: M4A mp42isom
    creation_time   : 2029-03-12 09:28:48
    iTunSMPB        :  00000000 00000840 00000052 00000000001D4B6E 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  Duration: 00:00:43.58, start: 0.000000, bitrate: 126 kb/s
    Stream #1:0(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 115 kb/s (default)
    Metadata:
      creation_time   : 2029-03-12 09:28:48
Input #2, mp3, from 'battisti.mp3':
  Metadata:
    Software        : Logic Pro 8.0.2
  Duration: 00:00:43.62, start: 0.025057, bitrate: 209 kb/s
    Stream #2:0: Audio: mp3, 44100 Hz, stereo, s16p, 209 kb/s
    Metadata:
      encoder         : LAME3.98r
Input #3, mov,mp4,m4a,3gp,3g2,mj2, from 'file_1.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2014-09-02 14:35:01
  Duration: 00:00:03.80, start: 0.000000, bitrate: 8631 kb/s
    Stream #3:0(eng): Video: qtrle (rle  / 0x20656C72), bgra, 120x120, 8614 kb/s, SAR 120:120 DAR 1:1, 25 fps, 25 tbr, 25 tbn, 25 tbc (default)
    Metadata:
      creation_time   : 2014-09-02 14:35:01
      handler_name    : Apple Alias Data Handler
      encoder         : Animation
      timecode        : 00:00:00:00
    Stream #3:1(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
    Metadata:
      creation_time   : 2014-09-02 14:35:06
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
Input #4, mov,mp4,m4a,3gp,3g2,mj2, from 'file_1.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2014-09-02 14:35:01
  Duration: 00:00:03.80, start: 0.000000, bitrate: 8631 kb/s
    Stream #4:0(eng): Video: qtrle (rle  / 0x20656C72), bgra, 120x120, 8614 kb/s, SAR 120:120 DAR 1:1, 25 fps, 25 tbr, 25 tbn, 25 tbc (default)
    Metadata:
      creation_time   : 2014-09-02 14:35:01
      handler_name    : Apple Alias Data Handler
      encoder         : Animation
      timecode        : 00:00:00:00
    Stream #4:1(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
    Metadata:
      creation_time   : 2014-09-02 14:35:06
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
[libx264 @ 0x3d47bc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x3d47bc0] profile High, level 2.1
[libx264 @ 0x3d47bc0] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'test.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: mp41mp42isom
    encoder         : Lavf55.51.101
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 568x320, q=-1--1, 24 fps, 12288 tbn, 24 tbc (default)
    Metadata:
      encoder         : Lavc55.72.102 libx264
    Stream #0:1(eng): Audio: aac (libfdk_aac) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, s16, 128 kb/s (default)
    Metadata:
      creation_time   : 2029-03-12 09:28:48
      encoder         : Lavc55.72.102 libfdk_aac
    Stream #0:2: Audio: aac (libfdk_aac) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, s16, 128 kb/s
    Metadata:
      encoder         : Lavc55.72.102 libfdk_aac
Stream mapping:
  Stream #0:0 (h264) -> overlay:main (graph 0)
  Stream #3:0 (qtrle) -> overlay:overlay (graph 0)
  Stream #4:0 (qtrle) -> overlay:overlay (graph 0)
  overlay (graph 0) -> Stream #0:0 (libx264)
  Stream #1:0 -> #0:1 (aac (native) -> aac (libfdk_aac))
  Stream #2:0 -> #0:2 (mp3 (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
frame= 1048 fps=228 q=-1.0 Lsize=    2795kB time=00:00:43.60 bitrate= 525.1kbits/s    
video:1381kB audio:1366kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.728943%
[libx264 @ 0x3d47bc0] frame I:5     Avg QP:19.68  size: 15730
[libx264 @ 0x3d47bc0] frame P:272   Avg QP:21.96  size:  3459
[libx264 @ 0x3d47bc0] frame B:771   Avg QP:24.28  size:   512
[libx264 @ 0x3d47bc0] consecutive B-frames:  0.8%  2.7%  2.3% 94.3%
[libx264 @ 0x3d47bc0] mb I  I16..4: 14.3% 60.5% 25.1%
[libx264 @ 0x3d47bc0] mb P  I16..4:  0.7%  1.1%  0.3%  P16..4: 61.0% 14.2% 10.1%  0.0%  0.0%    skip:12.7%
[libx264 @ 0x3d47bc0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 40.9%  0.5%  0.1%  direct: 0.6%  skip:57.8%  L0:39.2% L1:60.0% BI: 0.8%
[libx264 @ 0x3d47bc0] 8x8 transform intra:54.9% inter:68.7%
[libx264 @ 0x3d47bc0] coded y,uvDC,uvAC intra: 88.7% 95.8% 55.3% inter: 10.7% 22.5% 0.7%
[libx264 @ 0x3d47bc0] i16 v,h,dc,p: 12%  4% 36% 48%
[libx264 @ 0x3d47bc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 15% 24%  8%  8%  8%  7%  8%  8%
[libx264 @ 0x3d47bc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 23% 16%  7%  8%  7%  7%  6%  6%
[libx264 @ 0x3d47bc0] i8c dc,h,v,p: 57% 19% 17%  7%
[libx264 @ 0x3d47bc0] Weighted P-Frames: Y:0.7% UV:0.0%
[libx264 @ 0x3d47bc0] ref P L0: 64.7% 10.9% 19.3%  5.0%  0.1%
[libx264 @ 0x3d47bc0] ref B L0: 93.2%  6.1%  0.7%
[libx264 @ 0x3d47bc0] ref B L1: 96.5%  3.5%
[libx264 @ 0x3d47bc0] kb/s:259.03

Спасибо!

1 ответ1

0

Пример 1

https://trac.ffmpeg.org/wiki/How%20to%20use%20-map%20option

Моя интуиция заключалась в ваших опциях -map, и статья, кажется, подтверждает это.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками .