Recently, I found an ambience track that I quite like, which has helped me several times to sink into the undistracted trance-like state in which the best programming occurs.
- Title: "Rainy Night Coffee Shop Ambience with Relaxing Jazz Music and Rain Sounds - 8 Hours"
- Link: www.youtube.com/watch?v=c0_ejQQcrwI
- Channel: Calmed By Nature
- Date: May 3, 2020
I decided that I'd like to have my own copy. You never know when something will just disappear from the internet.
Also, I didn't want the entire 8-hour track. 1 hour on a loop is fine, and takes up less space.
Here's the approach I used:
0) Machine details.
- Windows 10
- Windows Subsystem for Linux (WSL): Ubuntu 16.04
I'm using the WSL Ubuntu terminal.
I already have the
1) Check the available formats on Youtube.
youtube-dl https://www.youtube.com/watch?v=c0_ejQQcrwI -F
2) Choose a format number. Download the video.
I chose format number 18 (mp4).
youtube-dl https://www.youtube.com/watch?v=c0_ejQQcrwI -f 18
The downloaded file was named "Rainy Night Coffee Shop Ambience with Relaxing Jazz Music and Rain Sounds - 8 Hours-c0_ejQQcrwI.mp4".
I renamed it to "ambience.mp4". It's 1.3 GB.
3) Extract the audio into its own file.
ffmpeg -i ambience.mp4 ambience.mp3
The audio file is 443 MB.
4) Split the audio file into hour-long segments. The last segment will contain any left-over portion of the track.
ffmpeg -i ambience.mp3 -f segment -segment_time 3600 -c copy out%03d.mp3
-segment_timevalue is in seconds.
5) Keep the first segment. Delete the others. Also delete the original ambience.mp4 and ambience.mp3 files.
The first segment ends on a jazz resolution and some rain noise, which means it will loop without causing a distraction. If it had ended on a jarring note, I would have looked for a good ending point and used an audio editor (e.g. Audacity) to edit the file to end at that point.
I can use the VLC media player to play it on a loop.
The final file is named "out000.mp3". It's 55 MB.
Rename it to: