Download a youtube video and turn it into a TV channel

Added by chris jennings 11 days ago

I would like to share the method I use to download a youtube video and turn it into a Tv channel that continuously loops the video
note: this is for playing a video saved on your server as a tv channel not a live feed from youtube.

This tutorial assumes readers are familiar with tvheadend basic config like creating networks, muxes etc.
I am using tvheadend 4.2.8-36 sourced from the official repo on a ubuntu 20.4 server with ffmpeg installed from the ubuntu repo

Download video
1. go to and find the video you want
2. play the video in youtube and copy the url
3. open a browser and go to
4. paste the url in the box, choose your resolution and download the video to your pc

Encode the video to h264 and upload to server
1. open a browser and go to
2. download and install the handbrake video convertor
4. open you downloaded video in handbrake
5. choose an mp4 preset, I use 720p fast
6. start the encode process, can take a long time. when finished you will have a tvheadend friendly m4v file.
7. upload your m4v file to your server, I made a folder in /home/hts called mp4

Create TV channel
1. Create an IPTV network. (not automatic)
2. Create a Mux in the IPTV network using the url below, nothing else needs to be done other than mux name
pipe:///usr/bin/ffmpeg -fflags +genpts -stream_loop -1 -i /home/hts/mp4/video.m4v -c copy -bsf:v h264_mp4toannexb -acodec copy -f mpegts pipe:1
Obviously adjust the "/home/hts/mp4/video.m4v" bit to your vid name and location
3. finally save the mux, scan, map service etc
boom, channel created

The url includes instructions to ffmpeg to overide the timestamps with its own and loop the video continuously.

Not tried but I guess this method can work for any movie etc that can be encoded to something usuable by tvheadend

Replies (1)

RE: Download a youtube video and turn it into a TV channel - Added by saen acro 11 days ago

pipe playlist with week of movies

Your "boom" now is thunderstorm ;)