a tampermonkey script to sample youtube videos
Installation
-
Install Tampermonkey Chrome Extension
- I haven't tested this on other browsers. It should work fine if they support MediaRecorder, however the media type (
video/webm
) might need to be changed.
- I haven't tested this on other browsers. It should work fine if they support MediaRecorder, however the media type (
-
Press "Create a new script" and paste in the contents of youtube_sampler.js. Make sure to read it first to check that it's nothing evil 😉. Control/Command + S to save and voila - you've done it.
Usage
- Go to a Youtube video.
- Use the sliders to control the start/end bounds of the loop a. It only works in 1-second increments; this is a limitation of Youtube's video player.
- When you are ready to record, press "record"
- Recording will automatically start and will stop when it's done
- You will be prompted to enter a file name - can call it anything, but don't include the file extension here.
- Press "result" to download the resulting webm file
Converting to audio
I wanted this to download just audio from the browser, but I couldn't figure it out (see stackoverflow) But, it's not such a big deal, because webm can be converted to wav very easily:
# converts webm => wav
ffmpeg -i my_file.webm -vn my_file.wav