Twitter Scapesという音声配信サービスがありますが,基本的にライブ.聴きたいものがあったのですが,体調不良で寝ていて聞けませんでした.
でも30日アーカイブが残るとのことなのでダウンロードしてスマホで聞いてみました.
配信最後までお聴きいただきありがとうござ>いました。アーカイブは 30日間残るようなので、聴き逃した方はぜひどうぞ。今後ともポッドキャスト #セキュリティのアレ 🏛️ をよろしくお願いします!! https://t.co/wUrkGp7nzy 🏛️
— Masafumi Negishi (@MasafumiNegishi) March 15, 2022 🏛️
まずはダウンロード,Youtube-dl, yt-dlpを試しましたがまだ未対応のよう.
今回Twspace-dlというものを試しました.
$ virtualenv .
$ source bin/activate
$ pip install twspace-dl
$ twspace_dl
usage: twspace_dl [-h] [-v] [-s] [-k] [-l] [--input-cookie-file COOKIE_FILE] [--username USERNAME]
[--password PASSWORD] [--output-cookie-file OUTPUT_COOKIE_FILE] [-i SPACE_URL | -U USER_URL]
[-d DYN_URL] [-f URL] [-M PATH] [-o FORMAT_STR] [-m] [-p] [-u] [--write-url URL_OUTPUT]
Script designed to help download twitter spaces
optional arguments:
-h, --help show this help message and exit
-v, --verbose
-s, --skip-download
-k, --keep-files
-l, --log create logfile
--input-cookie-file COOKIE_FILE
input:
-i SPACE_URL, --input-url SPACE_URL
-U USER_URL, --user-url USER_URL
-d DYN_URL, --from-dynamic-url DYN_URL
use the dynamic url for the processes(useful for ended spaces) example: https://prod-
fastly-ap-
northeast-1.video.pscp.tv/Transcoding/v1/hls/zUUpEgiM0M18jCGxo2eSZs99p49hfyFQr1l4cdze-
Sp4T-DQOMMoZpkbdyetgfwscfvvUkAdeF-I5hPI4bGoYg/non_transcode/ap-northeast-1/periscope-
replay-direct-prod-ap-northeast-1-public/audio-space/dynamic_playlist.m3u8?type=live
-f URL, --from-master-url URL
use the master url for the processes(useful for ended spaces) example: https://prod-
fastly-ap-northeast-1.video.pscp.tv/Transcoding/v1/hls/YRSsw6_P5xUZHMualK5-ihvePR6o4Qmo
ZVOBGicKvmkL_KB9IQYtxVqm3P_vpZ2HnFkoRfar4_uJOjqC8OCo5A/non_transcode/ap-
northeast-1/periscope-replay-direct-prod-ap-northeast-1-public/audio-
space/master_playlist.m3u8
-M PATH, --input-metadata PATH
use a metadata json file instead of input url (useful for very old ended spaces)
output:
-o FORMAT_STR, --output FORMAT_STR
-m, --write-metadata write the full metadata json to a file
-p, --write-playlist write the m3u8 used to download the stream(e.g. if you want to use another downloader)
-u, --url display the master url
--write-url URL_OUTPUT
write master url to file
login:
--username USERNAME
--password PASSWORD
--output-cookie-file OUTPUT_COOKIE_FILE早速ダウンロード
$ twspace_dl -i https://twitter.com/i/spaces/1ypKdEXLdLqGW
2022-03-16 15:42:16,496 [INFO] ./tmp6swcs0w5/(辻 伸弘 (nobuhiro tsuji))ゆくアレ、くるアレ #セキュリティのアレ-1ypKdEXLdLqGW.m3u8 written to disk
[hls @ 0x55f2ea4a9800] Changing ID3 metadata in HLS audio elementary stream is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
size= 51141kB time=01:13:21.68 bitrate= 95.2kbits/s speed=10.6x
2022-03-16 15:49:14,334 [INFO] Finished downloading
$ ffprobe -i ./\(辻\ 伸弘\ \(nobuhiro\ tsuji\)\)ゆくアレ、くるアレ\ #セキュリティのアレ-1ypKdEXLdLqGW.m4a
ffprobe version 4.4.1-3+b2 Copyright (c) 2007-2021 the FFmpeg developers
built with gcc 11 (Debian 11.2.0-18)
configuration: --prefix=/usr --extra-version=3+b2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --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-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './(辻 伸弘 (nobuhiro tsuji))ゆくアレ、くるアレ #セキュリティのアレ-1ypKdEXLdLqGW.m4a':
Metadata:
major_brand : M4A
minor_version : 512
compatible_brands: M4A isomiso2
title : ゆくアレ、くるアレ #セキュリティのアレ
artist : 辻 伸弘 (nobuhiro tsuji)
encoder : Lavf58.76.100
episode_id : 1ypKdEXLdLqGW
Duration: 01:13:21.71, start: 0.000000, bitrate: 95 kb/s
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 93 kb/s (default)
Metadata:
handler_name : SoundHandler
vendor_id : [0][0][0][0]ダウンロードできました.再生してみると音が出ない??先頭に無音が入ってるせいで少し進めると音が出ました.
てことで先日も使った ffmppeg の silenceremove フィルタで無音部分をカットします.
しきい値は前回と同じ -90dB だとほとんどカットできまぜんでした. -50dB でいい感じになったようです.
$ ffmpeg -i ./\(辻\ 伸弘\ \(nobuhiro\ tsuji\)\)ゆくアレ、くるアレ\ #セキュリティのアレ-1ypKdEXLdLqGW.m4a -af silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-50dB -acodec libopus ./\(辻\ 伸弘\ \(nobuhiro\ tsuji\)\)ゆくアレ、くるアレ\ #セキュリティのアレ-1ypKdEXLdLqGW.opus
01:13:21.71 → 01:09:51.71 になりました.てことでこれでスマホに転送して聞くことが出来ました.
ちなみに今回試した配信はPodcastの「セキュリティのアレ」の「サイバーセキュリティに関する総務大臣奨励賞」の受賞記念配信的なものでした.いつもは週一くらいでPodcastを配信されています.
環境
$ dpkg-query -W python3 ffmpeg ffmpeg 7:4.4.1-3+b2 python3 3.9.8-1 $ lsb_release -dr aDescription: Debian GNU/Linux bookworm/sid Release: unstable $ arch x86_64