无法使用FFmpeg缩放,填充和合并2个视频

时间:2018-11-20 21:54:41

标签: audio video ffmpeg video-processing

我正在使用FFMpeg缩放,填充和合并2个视频,并生成一个mp4文件。我正在使用以下命令,导致第二个视频的中间几秒钟内没有音频输出文件。另外,在我创建的黑框上有几秒钟的模糊白色边框。尽管命令中没有错误,但是我收到警告“ [swscaler @ 0x6987800]警告:数据未对齐!这可能会导致速度损失”。

我在这里检查了其他帖子,并尝试了提供的解决方案,但对我而言不起作用。如果有人可以帮助指出我的缺失,那就太好了。

谢谢。

以下是命令:

ffmpeg -i 1_a.opus -i 2_a.opus -itsoffset 0.024181 -i 01_v.webm -itsoffset 0.113192 -i 02_v.webm -filter_complex \
"[1:a]adelay=15726.168|15726.168[a1]; \
[0:a][a1]amix; \
[3:v]trim=0:15.726168,geq=0:128:128[silence]; \
[3:v]fifo[3v]; \
[silence][3v]concat[3_v_silence]; \
[3_v_silence]scale=-1:240[3v_scaled_240]; \
[3v_scaled_240]pad=width=320:height=240:x=(320-in_w)/2:y=(240-in_h)/2:color=black[3v_padded]; \
[2:v]scale=-1:240[2v_scaled_240]; \
[2v_scaled_240]pad=width=320:height=240:x=(320-in_w)/2:y=(240-in_h)/2:color=black[2v_padded]; \
[2v_padded]fifo[2v]; \
[2v][3v_padded]hstack[out_v]; \
[out_v]pad=width=640:height=480:x=(640-in_w)/2:y=(480-in_h)/2:color=black" \
-crf 40 -preset ultrafast -y -r pal out.mp4 

控制台输出:

ffmpeg version 4.0.2-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Input #0, ogg, from '1_a.opus':
  Duration: 00:01:03.82, start: -0.020000, bitrate: 37 kb/s
    Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
Input #1, ogg, from '2_a.opus':
  Duration: 00:00:52.40, start: -0.020000, bitrate: 44 kb/s
    Stream #1:0: Audio: opus, 48000 Hz, stereo, fltp
Input #2, matroska,webm, from '01_v.webm':
  Metadata:
    encoder         : Lavf56.40.101
  Duration: 00:01:03.83, start: 0.000000, bitrate: 202 kb/s
    Stream #2:0: Video: vp8, yuv420p(progressive), 640x480, SAR 1:1 DAR 4:3, 333 fps, 333 tbr, 1k tbn, 1k tbc (default)
Input #3, matroska,webm, from '02_v.webm':
  Metadata:
    encoder         : Lavf56.40.101
  Duration: 00:00:52.34, start: 0.000000, bitrate: 200 kb/s
    Stream #3:0: Video: vp8, yuv420p(progressive), 480x640, SAR 1:1 DAR 3:4, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
Stream mapping:
  Stream #0:0 (opus) -> amix:input0
  Stream #1:0 (opus) -> adelay
  Stream #2:0 (vp8) -> scale
  Stream #3:0 (vp8) -> trim
  Stream #3:0 (vp8) -> fifo
  amix -> Stream #0:0 (aac)
  pad -> Stream #0:1 (libx264)
Press [q] to stop, [?] for help
[swscaler @ 0x6484740] Warning: data is not aligned! This can lead to a speed loss
[libx264 @ 0x63a0d40] using SAR=1/1
[libx264 @ 0x63a0d40] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64 SlowShuffle
[libx264 @ 0x63a0d40] profile Constrained Baseline, level 3.0
[libx264 @ 0x63a0d40] 264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=40.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
Output #0, mp4, to 'out.mp4':
  Metadata:
    encoder         : Lavf58.12.100
    Stream #0:0: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      encoder         : Lavc58.18.100 aac
    Stream #0:1: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      encoder         : Lavc58.18.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 1598 fps=131 q=-1.0 Lsize=    1375kB time=00:01:08.16 bitrate= 165.3kbits/s dup=2 drop=1047 speed=5.57x    
video:455kB audio:883kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.787654%
[aac @ 0x63a31c0] Qavg: 32520.934
[libx264 @ 0x63a0d40] frame I:7     Avg QP:32.00  size:  5746
[libx264 @ 0x63a0d40] frame P:1591  Avg QP:33.93  size:   267
[libx264 @ 0x63a0d40] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264 @ 0x63a0d40] mb P  I16..4:  0.3%  0.0%  0.0%  P16..4:  4.2%  0.0%  0.0%  0.0%  0.0%    skip:95.5%
[libx264 @ 0x63a0d40] coded y,uvDC,uvAC intra: 21.3% 18.9% 3.0% inter: 1.1% 0.5% 0.0%
[libx264 @ 0x63a0d40] i16 v,h,dc,p: 54% 27% 11%  9%
[libx264 @ 0x63a0d40] i8c dc,h,v,p: 69% 17% 10%  4%
[libx264 @ 0x63a0d40] kb/s:58.22

0 个答案:

没有答案