Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Audio 加上黑色和黑色;视频开始时保持沉默_Audio_Video_Ffmpeg - Fatal编程技术网

Audio 加上黑色和黑色;视频开始时保持沉默

Audio 加上黑色和黑色;视频开始时保持沉默,audio,video,ffmpeg,Audio,Video,Ffmpeg,嗨,我正在努力用ffmpeg为视频的开头添加黑色和静音。我确实搜索了很多,但它们对我来说太复杂了。 下面的命令是我在视频末尾添加黑色和静音的命令,现在我如何将其调谐到视频的开头 ffmpeg -i input.mp4 -f lavfi -i color=s=1920x1080:d=10 -filter_complex [0:v][1]concat -af [0]apad -shortest output.mp4 看起来我需要使用adelay而不是apad,下面是对我有意义的命令,但音频不会延迟

嗨,我正在努力用ffmpeg为视频的开头添加黑色和静音。我确实搜索了很多,但它们对我来说太复杂了。 下面的命令是我在视频末尾添加黑色和静音的命令,现在我如何将其调谐到视频的开头

ffmpeg -i input.mp4 -f lavfi -i color=s=1920x1080:d=10 -filter_complex [0:v][1]concat -af [0]apad -shortest output.mp4
看起来我需要使用adelay而不是apad,下面是对我有意义的命令,但音频不会延迟

ffmpeg -i input.mp4 -f lavfi -i color=s=1920x1080:d=10 -filter_complex [1][0:v]concat -af [0]adelay=10  output.mp4
以下是输入信息和ffmpeg版本:

ffmpeg -i input.mp4 
ffmpeg version 4.2.1-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2019 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-gmp --enable-libgme --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-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab     --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
  Duration: 00:01:00.00, start: 0.000998, bitrate: 2526 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 2394 kb/s, 24 fps, 24 tbr, 16k tbn, 48 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 124 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
At least one output file must be specified

谢谢

有几种方法可以做到这一点。第一种方法简单易行,但对主要视频进行了重新编码。另一种方法稍微复杂一些,但不会对主视频进行重新编码,因此质量得以保持。对于长视频,这种方法速度更快

tpad&adelay滤波器 使用和过滤器:

如果您的
ffmpeg
版本早于4.2版,则将
adelay=2s:all=true
更改为
adelay=2000 | 2000

带concat解复用器的彩色和anullsrc滤光片
  • 使2秒钟的黑色和静音与输入的属性相匹配。使用和过滤器:

  • 使
    join.txt
    包含:

     file 'black.mp4'
     file 'input.mp4'
    
  • 连接到:


  • @吉安帮助please@llogan帮助please@llogan您好,我已经编辑了这个问题,谢谢您。非常感谢您的帮助。我尝试了第二种方法,效果很好,使用join.txt,我可以将black.mp4放在我喜欢的任何地方。
    ffmpeg -f lavfi -i color=size=1920x1080:rate=24:duration=2 -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 -video_track_timescale 16k -shortest black.mp4
    
     file 'black.mp4'
     file 'input.mp4'
    
     ffmpeg -f concat -i join.txt -c copy output.mp4