質問: youtube-dlでライブyoutubeソースを使用するときにffmpeg -tを使用する方法 https://www.youtube.com/watch?v=0r0t0mqmx7i からyoutubeストリームをダウンロードしたかったので、好きな時間を追加しました。したがって、youtube-dlを使用して、すべての形式を取得します。$ youtube-dl --list-formats https://www.youtube.com/watch?v=0r0t0mqmx7i [youtube] 0r0t0mqmx7i: downloading webpage [youtube] 0r0t0mqmx7i: downloading video info webpage [youtube] 0r0t0mqmx7i: extracting video information [youtube] 0r0t0mqmx7i: downloading mpd manifest [info] available formats for 0r0t0mqmx7i: format code extension resolution note 140 m4a audio only dash audio 144k , m4a_dash container, mp4a.40.2@128k 160 mp4 256x144 144p 124k , avc1.42c00b, 30fps, video only 133 mp4 426x240 240p 258k , avc1.4d4015, 30fps, video only 134 mp4 640x360 360p 646k , avc1.4d401e, 30fps, video only 135 mp4 854x480 480p 1171k , avc1.4d401f, 30fps, video only 136 mp4 1280x720 720p 2326k , avc1.4d401f, 30fps, video only (best) オーディオとビデオのフォーマットが異なるため、簡単ではないことに気付きました。そこで、次のコマンドを使用してオーディオとビデオを抽出します。$ ffmpeg -i $(youtube-dl -f 136 -g https://www.youtube.com/watch?v=0r0t0mqmx7i) -i $(youtube-dl -f 140 -g https://www.youtube.com/watch?v=0r0t0mqmx7i) -c:v copy -c:a aac -strict experimental -t 00:02:00 output.mp4 しかし、それは機能しません。 5秒まで記録するだけです。 「-t 00:02:00」パラメータを別の場所に移動しようとしましたが、機能しません。誰もが解決策を知っていますか?ありがとう!!edited:出力の追加$ ffmpeg -i $(youtube-dl -f 136 -g https://www.youtube.com/watch?v=0r0t0mqmx7i) -i $(youtube-dl -f 140 -g https://www.youtube.com/watch?v=0r0t0mqmx7i) -c:v copy -c:a aac -strict experimental -t 00:02:00 output.mp4 ffmpeg version 2.8.11-0ubuntu0.16.04.1 copyright (c) 2000-2017 the ffmpeg developers built with gcc 5.4.0 (ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609 configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv libavutil 54. 31.100 / 54. 31.100 libavcodec 56. 60.100 / 56. 60.100 libavformat 56. 40.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 40.101 / 5. 40.101 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.101 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100 input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'https://r1---sn-j5cax8pnpvo-x1xe6.googlevideo.com/videoplayback?keepalive=yes&source=yt_live_broadcast&pl=24&itag=136&mime=video%2fmp4&expire=1521354001&c=web&sparams=aitags%2ccmbypass%2cei%2cgcr%2cgir%2chang%2cid%2cip%2cipbits%2citag%2ckeepalive%2clive%2cmime%2cmm%2cmn%2cms%2cmv%2cnoclen%2cpl%2crequiressl%2csource%2cexpire&aitags=133%2c134%2c135%2c136%2c160&signature=727e04bde2851159a8a9327cdbab503bbdc37267.2168845a24d2ffd5496aa2f5d2d6aaca59bb69d2&cmbypass=yes&ipbits=0&hang=1&beids=%5b9466592%5d&ms=lv&mt=1521331971&mv=u&live=1&key=yt6&ip=152.168.37.75&id=0r0t0mqmx7i.0&gir=yes&mm=32&mn=sn-j5cax8pnpvo-x1xe6&ei=sbctwvocljtwxas644e4ag&noclen=1&gcr=ar&requiressl=yes&ratebypass=yes': metadata: major_brand : dash minor_version : 0 compatible_brands: iso6avc1mp41 creation_time : 2018-03-17 07:02:10 duration: 00:00:05.00, start: 0.000000, bitrate: 2419 kb/s stream #0:0(und): video: h264 (main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [sar 1:1 dar 16:9], 2413 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc (default) metadata: creation_time : 2018-03-17 07:02:10 handler_name : videohandler input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'https://r1---sn-j5cax8pnpvo-x1xe6.googlevideo.com/videoplayback?ip=152.168.37.75&mm=32&mn=sn-j5cax8pnpvo-x1xe6&expire=1521354004&pl=24&gir=yes&signature=16f13864fdf56ffdf2e08b248355cd1257d2e4ff.c7dbd2a865733005704660cd0ea82a90efcfc03d&id=0r0t0mqmx7i.0&mt=1521331971&mv=u&ms=lv&hang=1&ipbits=0&itag=140&gcr=ar&requiressl=yes&source=yt_live_broadcast&keepalive=yes&ei=s7ctwsq0ko7uxqt__psgba&noclen=1&sparams=cmbypass%2ccompress%2cei%2cgcr%2cgir%2chang%2cid%2cip%2cipbits%2citag%2ckeepalive%2clive%2cmime%2cmm%2cmn%2cms%2cmv%2cnoclen%2cpl%2crequiressl%2csource%2cexpire&cmbypass=yes&compress=yes&key=yt6&mime=audio%2fmp4&c=web&live=1&ratebypass=yes': metadata: major_brand : dash minor_version : 0 compatible_brands: iso6mp41 creation_time : 2018-03-17 07:02:09 duration: 00:00:04.99, start: 0.000000, bitrate: 130 kb/s stream #1:0(und): audio: aac (lc) (mp4a / 0x6134706d), 48000 hz, stereo, fltp, 125 kb/s (default) metadata: creation_time : 2018-03-17 07:02:09 handler_name : soundhandler [mp4 @ 0x264eb20] codec for stream 0 does not use global headers but container format requires global headers output #0, mp4, to 'output.mp4': metadata: major_brand : dash minor_version : 0 compatible_brands: iso6avc1mp41 encoder : lavf56.40.101 stream #0:0(und): video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [sar 1:1 dar 16:9], q=2-31, 2413 kb/s, 30 fps, 30 tbr, 90k tbn, 90k tbc (default) metadata: creation_time : 2018-03-17 07:02:10 handler_name : videohandler stream #0:1(und): audio: aac ([64][0][0][0] / 0x0040), 48000 hz, stereo, fltp, 128 kb/s (default) metadata: creation_time : 2018-03-17 07:02:09 handler_name : soundhandler encoder : lavc56.60.100 aac stream mapping: stream #0:0 -> #0:0 (copy) stream #1:0 -> #0:1 (aac (native) -> aac (native)) press [q] to stop, [?] for help frame= 150 fps=0.0 q=-1.0 lsize= 1557kb time=00:00:04.99 bitrate=2555.6kbits/s video:1473kb audio:79kb subtitle:0kb other streams:0kb global headers:0kb muxing overhead: 0.353100%
回答: tl; dr:ffmpeg±_youtube-dl_を更新します。コンソール出力を含めると役に立ちました!入力は5秒としてのみ検出されます_input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'https://r1---sn-j5cax8pnpvo-x1xe6.googlevideo.com/videoplayback?keepalive=yes&source=yt_live_broadcast&pl=24&itag=136&mime=video%2fmp4&expire=1521354001&c=web&sparams=aitags%2ccmbypass%2cei%2cgcr%2cgir%2chang%2cid%2cip%2cipbits%2citag%2ckeepalive%2clive%2cmime%2cmm%2cmn%2cms%2cmv%2cnoclen%2cpl%2crequiressl%2csource%2cexpire&aitags=133%2c134%2c135%2c136%2c160&signature=727e04bde2851159a8a9327cdbab503bbdc37267.2168845a24d2ffd5496aa2f5d2d6aaca59bb69d2&cmbypass=yes&ipbits=0&hang=1&beids=%5b9466592%5d&ms=lv&mt=1521331971&mv=u&live=1&key=yt6&ip=152.168.37.75&id=0r0t0mqmx7i.0&gir=yes&mm=32&mn=sn-j5cax8pnpvo-x1xe6&ei=sbctwvocljtwxas644e4ag&noclen=1&gcr=ar&requiressl=yes&ratebypass=yes': metadata: ... duration: 00:00:05.00, start: 0.000000, bitrate: 2419 kb/s input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'https://r1---sn-j5cax8pnpvo-x1xe6.googlevideo.com/videoplayback?ip=152.168.37.75&mm=32&mn=sn-j5cax8pnpvo-x1xe6&expire=1521354004&pl=24&gir=yes&signature=16f13864fdf56ffdf2e08b248355cd1257d2e4ff.c7dbd2a865733005704660cd0ea82a90efcfc03d&id=0r0t0mqmx7i.0&mt=1521331971&mv=u&ms=lv&hang=1&ipbits=0&itag=140&gcr=ar&requiressl=yes&source=yt_live_broadcast&keepalive=yes&ei=s7ctwsq0ko7uxqt__psgba&noclen=1&sparams=cmbypass%2ccompress%2cei%2cgcr%2cgir%2chang%2cid%2cip%2cipbits%2citag%2ckeepalive%2clive%2cmime%2cmm%2cmn%2cms%2cmv%2cnoclen%2cpl%2crequiressl%2csource%2cexpire&cmbypass=yes&compress=yes&key=yt6&mime=audio%2fmp4&c=web&live=1&ratebypass=yes': metadata: ... duration: 00:00:04.99, start: 0.000000, bitrate: 130 kb/s _ffmpegバージョンはかなり古いです ffmpeg version 2.8.11-0ubuntu0.16.04.1 copyright (c) 2000-2017 the ffmpeg developers 2.8は2016年の初めごろから、日付はわかります。最新のffmpegに更新することを強くお勧めします。できれば最新の_git head_ですが、それ以外の場合は このppaが役立つかもしれません ubuntuの場合。_youtube-dl_バージョンも更新する同じurlについて、まったく異なる出力が表示されます。_$ youtube-dl --list-formats https://www.youtube.com/watch?v=0r0t0mqmx7i [youtube] 0r0t0mqmx7i: downloading webpage [youtube] 0r0t0mqmx7i: downloading video info webpage [youtube] 0r0t0mqmx7i: extracting video information [youtube] 0r0t0mqmx7i: downloading m3u8 information [youtube] 0r0t0mqmx7i: downloading mpd manifest [info] available formats for 0r0t0mqmx7i: format code extension resolution note 91 mp4 256x144 hls 197k , avc1.42c00b, 30.0fps, mp4a.40.5@ 48k 92 mp4 426x240 hls 338k , avc1.4d4015, 30.0fps, mp4a.40.5@ 48k 93 mp4 640x360 hls 829k , avc1.4d401e, 30.0fps, mp4a.40.2@128k 94 mp4 854x480 hls 1380k , avc1.4d401f, 30.0fps, mp4a.40.2@128k 95 mp4 1280x720 hls 2593k , avc1.4d401f, 30.0fps, mp4a.40.2@256k (best) $ youtube-dl --version 2018.03.14 _最近のffmpegおよび_youtube-dl_バージョンを使用すると、期待どおりの結果が得られます。_$ ffmpeg -i $(youtube-dl -f 91 -g https://www.youtube.com/watch?v=0r0t0mqmx7i) \ -i $(youtube-dl -f 95 -g https://www.youtube.com/watch?v=0r0t0mqmx7i) \ -c:v copy -c:a aac -strict experimental -t 00:02:00 output.mp4 (...) $ ffprobe output.mp4 input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4': metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : lavf57.83.100 duration: 00:02:00.02, start: 0.000000, bitrate: 1784 kb/s stream #0:0(und): video: h264 (main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [sar 1:1 dar 16:9], 1648kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc (default) metadata: handler_name : videohandler stream #0:1(und): audio: aac (lc) (mp4a / 0x6134706d), 48000 hz, stereo, fltp, 129 kb/s (default) metadata: handler_name : soundhandler _例(ビデオ)出力、2mbのアップロード制限に合わせてサイズ変更: ffmpeg呼び出しからの完全な出力 。