ffmpeg 在管道传输两个输入时冻结

ffmpeg 在管道传输两个输入时冻结

我目前有一个命令,它有两个管道输出输入到 ffmpeg 的两个管道中

{ youtube-dl -f bestaudio[ext!=webm]/140/best[ext!=webm] --no-cache-dir -o - https://www.youtube.com/watch?v=sGIm0-dQd8M; youtube-dl -f 135/best --no-cache-dir -o - https://www.youtube.com/watch?v=sGIm0-dQd8M; } | ffmpeg -i pipe:0 -i pipe:1 -c:v copy -c:a aac -strict experimental output.mp4 -loglevel debug

问题是 ffmpeg 一旦到达这个位置就会挂起并且永远不会完成

ffmpeg version 4.1-1~18.04.york0 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-27ubuntu1~18.04)
  configuration: --prefix=/usr --extra-version='1~18.04.york0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument 'pipe:0'.
Reading option '-i' ... matched as input url with argument 'pipe:1'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'aac'.
Reading option '-strict' ...Routing option strict to both codec and muxer layer
 matched as AVOption 'strict' with argument 'experimental'.
Reading option 'output.mp4' ... matched as output url.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url pipe:0.
Successfully parsed a group of options.
Opening an input file: pipe:0.
[NULL @ 0x5582cfbb0b40] Opening 'pipe:0' for reading
[pipe @ 0x5582cfbb1600] Setting default whitelist 'crypto'
[youtube] sGIm0-dQd8M: Downloading webpage
[youtube] sGIm0-dQd8M: Downloading video info webpage
[youtube] sGIm0-dQd8M: Downloading js player vflhRp6T6
[youtube] sGIm0-dQd8M: Downloading js player vflhRp6T6
[download] Destination: -
[download]   0.9% of 3.36MiB at  1.28MiB/s ETA 00:02[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5582cfbb0b40] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5582cfbb0b40] ISO: File Type Major Brand: dash
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5582cfbb0b40] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5582cfbb0b40] found sidx time -9223372036854775808, using it for pts
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5582cfbb0b40] Before avformat_find_stream_info() pos: 2776 bytes read:3072 seeks:0 nb_streams:1
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5582cfbb0b40] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5582cfbb0b40] After avformat_find_stream_info() pos: 3147 bytes read:31744 seeks:0 frames:1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'pipe:0':
  Metadata:
    major_brand     : dash
    minor_version   : 0
    compatible_brands: iso6mp41
    creation_time   : 2018-12-04T00:48:46.000000Z
  Duration: 00:03:37.69, start: 0.000000, bitrate: N/A
    Stream #0:0(und), 1, 1/44100: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 5 kb/s (default)
    Metadata:
      creation_time   : 2018-12-04T00:48:46.000000Z
      handler_name    : ISO Media file produced by Google Inc. Created on: 12/03/2018.
Successfully opened the file.
Parsing a group of options: input url pipe:1.
Successfully parsed a group of options.
Opening an input file: pipe:1.
[NULL @ 0x5582cfbc09c0] Opening 'pipe:1' for reading
[pipe @ 0x5582cfbc1680] Setting default whitelist 'crypto'
[download]   1.8% of 3.36MiB at  1.31MiB/s ETA 00:02

相关内容