# How to get a Fireplace Video from YouTube to TV

Hi everyone I want to share with you a little solution to a problem that I had on Christmas Day. I was invited to celebrate Christmas in my father-in-law's house, however there is no fireplace in that house to create some Christmas atmosphere. So I thought I'd show a YouTube video like [this](https://www.youtube.com/watch?v=bmGsQkLb4yg) on television, however in this location Internet connection is not very stable and not so much fast so I got ready to download the YouTube video, put it on a USB stick and see it on television.
I've done all the steps on my Mac, on GNU/Linux it's the same... on Windows I don't know and I don't even remember the last time I used it.

All steps involved two simple programs and I used them from the command line:

- [youtube-dl](https://ytdl-org.github.io/youtube-dl/): is a command-line program to download videos from YouTube
- [FFmpeg](https://ffmpeg.org/): a complete, cross-platform solution to record, convert and stream audio and video

### List YouTube Video/Audio Options
With youtube-dl you can list all the download options for a custom video by passing its url

```
youtube-dl --list-formats  "https://www.youtube.com/watch?v=bmGsQkLb4yg"
``` 

and you'll get 

```
249    webm    audio only tiny   60k , opus @ 50k (48000Hz), 42.13MiB
250    webm    audio only tiny   78k , opus @ 70k (48000Hz), 56.57MiB
140    m4a     audio only tiny  137k , m4a_dash container, mp4a.40.2@128k (44100Hz), 111.29MiB
251    webm    audio only tiny  151k , opus @160k (48000Hz), 118.74MiB
394    mp4     256x144    144p   99k , av01.0.00M.08, 30fps, video only, 55.79MiB
278    webm    256x144    144p  139k , webm container, vp9, 30fps, video only, 81.72MiB
160    mp4     256x144    144p  144k , avc1.4d400c, 30fps, video only, 95.50MiB
395    mp4     426x240    240p  188k , av01.0.00M.08, 30fps, video only, 132.78MiB
242    webm    426x240    240p  270k , vp9, 30fps, video only, 190.22MiB
133    mp4     426x240    240p  278k , avc1.4d4015, 30fps, video only, 210.37MiB
396    mp4     640x360    360p  331k , av01.0.01M.08, 30fps, video only, 254.16MiB
243    webm    640x360    360p  456k , vp9, 30fps, video only, 350.07MiB
397    mp4     854x480    480p  597k , av01.0.04M.08, 30fps, video only, 483.59MiB
134    mp4     640x360    360p  650k , avc1.4d401e, 30fps, video only, 539.06MiB
244    webm    854x480    480p  789k , vp9, 30fps, video only, 640.21MiB
135    mp4     854x480    480p 1191k , avc1.4d401f, 30fps, video only, 995.58MiB
398    mp4     1280x720   720p 1202k , av01.0.05M.08, 30fps, video only, 992.10MiB
247    webm    1280x720   720p 1540k , vp9, 30fps, video only, 1.26GiB
399    mp4     1920x1080  1080p 2150k , av01.0.08M.08, 30fps, video only, 1.75GiB
136    mp4     1280x720   720p 2321k , avc1.4d401f, 30fps, video only, 1.90GiB
248    webm    1920x1080  1080p 2702k , vp9, 30fps, video only, 2.22GiB
137    mp4     1920x1080  1080p 4074k , avc1.640028, 30fps, video only, 3.21GiB
400    mp4     2560x1440  1440p 6516k , av01.0.12M.08, 30fps, video only, 5.33GiB
271    webm    2560x1440  1440p 8877k , vp9, 30fps, video only, 7.38GiB
401    mp4     3840x2160  2160p 13207k , av01.0.12M.08, 30fps, video only, 10.71GiB
313    webm    3840x2160  2160p 17792k , vp9, 30fps, video only, 14.74GiB
43     webm    640x360    360p , vp8.0, vorbis@128k, 736.41MiB
18     mp4     640x360    360p  738k , avc1.42001E, mp4a.40.2@ 96k (44100Hz), 634.79MiB
22     mp4     1280x720   720p 3280k , avc1.64001F, mp4a.40.2@192k (44100Hz) (best)
```

### Download files

In this case I want to download the video at FullHD resolution with the audio so I want rows 137 (mp4 video 1920x1080) and  140 (m4a audio). So It's simple as type

```
youtube-dl -f 137+140 "https://www.youtube.com/watch?v=bmGsQkLb4yg"
```

### Merge files

Now I renamed video file `fireplace.mp4` and the audio one `fireplace.m4a`, and merged them with 

```
ffmpeg -i fireplace.mp4 -i fireplace.m4a -c:v copy -c:a copy output.mp4
```

And last but not least I put the `output.mp4` video on a 4Gb USB stick to see it on television 🤓

Bye Alberto
