Задать вопрос
@alysenko

Почему при кодировании видео с помощью ffmpeg возникает ошибка «Error while filtering»?

Использую ffmeg для накладывания видео на изображение и склейки нескольких видео. Но в процессе кодирования появляется ошибка "Error while filtering". Она не прерывает процесс, но хотелось бы знать, что является причиной её появления.
К тому же процесс кодирования периодически прерывается сообщением "Killed".
Все это происходит в Laravel Homestead боксе на Vagrant.

Интересует два вопроса:
1. В чем причина появления ошибки "Error while filtering"?
2. Как предотвратить прерывание процесса?

ffmpeg -loop 1 -i img.png -i vid.mp4 -filter_complex "[0:v]  setpts=PTS-STARTPTS, scale=w=1920:1080
 [v0];[1:v]  setpts=PTS-STARTPTS, scale=w=1920:1080 [v1];[v0][v1]overlay=shortest=1:x=0:y=0" -c:v libx264 -pix_fmt
 yuv420p -an output_file.mp4

ffmpeg version 3.3.1-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.1 (Debian 5.4.1-8) 20170304
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
Input #0, png_pipe, from 'img.png':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: png, rgba(pc), 1920x1080 [SAR 2835:2835 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'vid.mp4
':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.71.100
  Duration: 00:00:07.90, start: 0.000000, bitrate: 4034 kb/s
    Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 4030 kb/s, 30
 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 (png) -> setpts
  Stream #1:0 (h264) -> setpts
  overlay -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
[libx264 @ 0x5b96600] using SAR=1/1
[libx264 @ 0x5b96600] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 LZCNT
[libx264 @ 0x5b96600] profile High, level 4.0
[libx264 @ 0x5b96600] 264 - core 148 r333 90a61ec - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.video
lan.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 m
ixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 thread
s=3 lookahead_threads=1 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=25 scenecut=40 intr
a_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 'output_file.mp4':
  Metadata:
    encoder         : Lavf57.71.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 2
5 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      encoder         : Lavc57.89.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Error while filtering=28.0 size=    2979kB time=00:00:05.68 bitrate=4296.1kbits/s speed=0.311x
frame=  197 fps=9.6 q=-1.0 Lsize=    3462kB time=00:00:07.76 bitrate=3654.3kbits/s speed=0.38x
video:3459kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.084196%
[libx264 @ 0x5b96600] frame I:5     Avg QP:16.17  size: 48170
[libx264 @ 0x5b96600] frame P:94    Avg QP:23.50  size: 24228
[libx264 @ 0x5b96600] frame B:98    Avg QP:25.13  size: 10436
[libx264 @ 0x5b96600] consecutive B-frames: 20.8% 30.5% 24.4% 24.4%
[libx264 @ 0x5b96600] mb I  I16..4: 47.1% 48.0%  4.9%
[libx264 @ 0x5b96600] mb P  I16..4:  6.5% 19.2%  0.7%  P16..4: 26.8%  6.9%  1.4%  0.0%  0.0%    skip:38.5%
[libx264 @ 0x5b96600] mb B  I16..4:  1.8%  3.3%  0.1%  B16..8: 27.2%  3.8%  0.4%  direct: 2.1%  skip:61.2%  L0:51.
5% L1:45.3% BI: 3.2%
[libx264 @ 0x5b96600] 8x8 transform intra:67.8% inter:90.5%
[libx264 @ 0x5b96600] coded y,uvDC,uvAC intra: 41.7% 51.0% 3.3% inter: 9.6% 13.0% 0.1%
[libx264 @ 0x5b96600] i16 v,h,dc,p: 37% 30%  5% 28%
[libx264 @ 0x5b96600] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 33% 15%  4%  4%  4%  5%  4%  7%
[libx264 @ 0x5b96600] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 31%  8%  3%  5%  7%  6%  4%  4%
[libx264 @ 0x5b96600] i8c dc,h,v,p: 52% 26% 17%  5%
[libx264 @ 0x5b96600] Weighted P-Frames: Y:1.1% UV:0.0%
[libx264 @ 0x5b96600] ref P L0: 79.0% 15.0%  5.0%  0.9%  0.0%
[libx264 @ 0x5b96600] ref B L0: 95.4%  4.2%  0.4%
[libx264 @ 0x5b96600] ref B L1: 99.6%  0.4%
[libx264 @ 0x5b96600] kb/s:3594.96
ffmpeg -i vid_2.mp4 -i dfgsdfg.mp4 -filter_complex "[0]scale=1080:608,pad=1080:1920:
0:656,setdar=9/16[v0];[1]scale=1080:1920,pad=1080:1920:0:0,setdar=9/16[v1]; [v0][v1] concat=2, format=yuv420p[v]"
-map "[v]" -r 30 -c:v libx264 -an slideshow_portrait.mp4
ffmpeg version 3.3.1-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.1 (Debian 5.4.1-8) 20170304
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'vid_2.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41iso4
    creation_time   : 2017-10-05T14:41:15.000000Z
  Duration: 00:00:03.95, start: 0.000000, bitrate: 980 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360, 913 kb/s, 29.98 fp
s, 29.98 tbr, 90k tbn, 59.96 tbc (default)
    Metadata:
      creation_time   : 2017-10-05T14:41:15.000000Z
      handler_name    : Vireo Eyes v2.4.22
      encoder         : AVC Coding
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 64 kb/s (default)
    Metadata:
      creation_time   : 2017-10-05T14:41:15.000000Z
      handler_name    : Vireo Ears v2.4.22
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'dfgsdfg.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41iso4
    creation_time   : 2017-10-05T22:25:14.000000Z
  Duration: 00:00:03.97, start: 0.000000, bitrate: 948 kb/s
    Stream #1:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 360x640, 879 kb/s, 29.97 fp
s, 29.97 tbr, 600 tbn, 59.96 tbc (default)
    Metadata:
      creation_time   : 2017-10-05T22:25:14.000000Z
      handler_name    : Vireo Eyes v2.4.22
      encoder         : AVC Coding
    Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 64 kb/s (default)
    Metadata:
      creation_time   : 2017-10-05T22:25:14.000000Z
      handler_name    : Vireo Ears v2.4.22
Stream mapping:
  Stream #0:0 (h264) -> scale
  Stream #1:0 (h264) -> scale
  format -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
[libx264 @ 0x4817200] using SAR=1/1
[libx264 @ 0x4817200] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 LZCNT
[libx264 @ 0x4817200] profile High, level 4.0
[libx264 @ 0x4817200] 264 - core 148 r333 90a61ec - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.video
lan.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 m
ixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 thread
s=3 lookahead_threads=1 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=25 scenecut=40 intr
a_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 'slideshow_portrait.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41iso4
    encoder         : Lavf57.71.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1080x1920 [SAR 1:1 DAR 9:16], q=-1--1, 3
0 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      encoder         : Lavc57.89.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame=  237 fps= 12 q=-1.0 Lsize=    3534kB time=00:00:07.80 bitrate=3711.6kbits/s speed=0.402x
video:3531kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.086233%
[libx264 @ 0x4817200] frame I:4     Avg QP:18.77  size: 32540
[libx264 @ 0x4817200] frame P:122   Avg QP:20.83  size: 20162
[libx264 @ 0x4817200] frame B:111   Avg QP:21.76  size:  9236
[libx264 @ 0x4817200] consecutive B-frames: 30.8% 11.0% 27.8% 30.4%
[libx264 @ 0x4817200] mb I  I16..4: 37.7% 58.3%  3.9%
[libx264 @ 0x4817200] mb P  I16..4: 14.8% 30.4%  0.7%  P16..4: 15.7%  4.2%  1.1%  0.0%  0.0%    skip:33.2%
[libx264 @ 0x4817200] mb B  I16..4:  2.3%  2.8%  0.1%  B16..8: 23.2%  3.8%  0.5%  direct: 3.0%  skip:64.4%  L0:51.
9% L1:44.6% BI: 3.6%
[libx264 @ 0x4817200] 8x8 transform intra:64.7% inter:87.9%
[libx264 @ 0x4817200] coded y,uvDC,uvAC intra: 22.2% 38.2% 2.2% inter: 7.6% 12.6% 0.0%
[libx264 @ 0x4817200] i16 v,h,dc,p: 29% 30%  6% 35%
[libx264 @ 0x4817200] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 43% 22% 20%  2%  2%  3%  3%  2%  2%
[libx264 @ 0x4817200] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34% 29% 10%  3%  5%  7%  5%  3%  4%
[libx264 @ 0x4817200] i8c dc,h,v,p: 56% 19% 21%  4%
[libx264 @ 0x4817200] Weighted P-Frames: Y:4.1% UV:2.5%
[libx264 @ 0x4817200] ref P L0: 77.3% 12.9%  8.1%  1.7%  0.1%
[libx264 @ 0x4817200] ref B L0: 94.7%  4.7%  0.6%
[libx264 @ 0x4817200] ref B L1: 99.3%  0.7%
[libx264 @ 0x4817200] kb/s:3660.84
Killed
  • Вопрос задан
  • 1037 просмотров
Подписаться 1 Средний Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы