How to record Youtube live streams on a Linux server

Coachella streams a load of their sets every year on Youtube and nobody seems to record them all. So I had to volunteer starting in 2015. Some rips you find are one-off screen recordings using some software like Camtasia, which nearly always drop frames and are kinda shit. You have to record directly from the Youtube source for the best quality. youtube-dl is great but is designed for downloading normal Youtube videos and I never got it working to record live. The only thing that worked for me was livestreamer, which was discontinued but was forked as streamlink. Here’s my streamlink command which worked for recording Coachella 2018 channel 1:
streamlink --http-no-ssl-verify best -o "output.ts"

I had a problem with SSL certs so had to add a no-verify but you probably don’t need it. Run that command and streamlink should start recording. Ctrl+C to stop recording. You’re now left with a .ts transport stream file which Youtube broadcasts in to help with error correction over the Internet. You can play these .ts files in VLC and MPC but seeking in them is annoyingly slow and VLC can sometimes play the audio out of sync. Also, they don’t seem to have a table of contents or whatever it’s called, so they’re missing a duration. This is bad for me as I need to play the video files direct from the server and pick the start and stop times to cut the Coachella streams into individual sets. So I prefer to convert to MP4 using ffmpeg, with this command:
ffmpeg -i input.ts -acodec copy -bsf:a aac_adtstoasc -vcodec copy output.mp4

If you’re recording a long Youtube live stream, like I am with the 9 hour Coachella streams, sometimes the stream can fail for whatever reason. Youtube seems to always break at 6 hours. You need a way for Streamlink to start back up if it fails so you don’t miss anything. The only solution I could come up with is a while true loop in a streamlink bash shell script.
#! /bin/bash
while true;
while [[ -e $dir/ts_segments/$name-$i.ts ]] ; do
let i++
streamlink --http-no-ssl-verify best -o "$dir/ts_segments/$name.ts";

Note that when you run this bash script, you can’t just stop it with Ctrl+C. It’ll restart the streamlink command like it’s supposed to. You have to kill -9 it. Find the PID of the bash script with ps -ef and kill it. You’re left with an orphaned streamlink command which you’ve to kill -9 as well, but it won’t restart as the bash script was already killed. Make sure you understand how to stop the shell script before starting it!

The shell script will start with saving the .ts files to sunday_ch1/ts_segments/coachella_ch1-1.ts. The while -e line returns true if the file exists, and if so increments i by one to ensure you always write sequentially. So when the script restarts, it writes to coachella_ch1-2.ts and won’t overwrite coachella_ch1-1.ts and so on.

I run my bash scripts in screensessions so I can log out of the server and let it do its thing. So that’s my recording setup. Other stuff I do is cut the long streams into individual sets with ffmpeg, add those sets to my database, upload them to Mega or Google Drive using the APIs so I get the Mega/GDrive link into the database and output the links into a formatted Reddit post, but that’s all outside the scope of this blog post.

Hope this helps someone! Leave a comment if you’ve any questions, don’t email me.

Ticketmaster Ticketfast Barcode Format

If you’ve ever bought tickets to a big sporting or music event, you’ve probably had to deal with TicketMaster and their extortionate handling fees. They charge it even if you’re using the print-at-home eTicket format called TicketFast. These tickets have a 16 digit number and barcode that is scanned at the gate against a database of purchases. I assumed this barcode was some kind of proprietary format to make it harder to clone tickets if you knew a valid number but it turns out it’s just an interleaved 2 of 5 barcode.

This doesn’t matter as long as customers keep their 16 digit number secret but a simple search of eBay and other buy/sell sites often have photos of seller’s printouts. As long as you can make out the number, you can create a barcode and paste it over another TicketFast and clone the ticket. Then you just need to get to the venue before the real ticketholder and their ticket won’t scan at entrance. Here’s some images I found on eBay, DoneDeal and Gumtree coming up to Electric Picnic recently. It was sold out and demand was high. I presume showing these tickets is OK now seeing as the festival is over.


Lol at this one. They blacked out all information except the important stuff.

Lol at this one. They blacked out all information except the important stuff.

I used this fantastic Barcode PHP library to generate the new barcodes. I needed to make a few adjustments to the code to get the barcodes looking the same as the TicketMaster ones but I think they ended up good. Take the last image as an example. You can just about make out the number to be: 3458 4242 6099 3291

And here’s my generated barcodes in both horizontal and vertical format:


They scanned fine on my Android barcode reader but I obviously didn’t test at the festival entrance with real stolen tickets as I’m not a scumbag and I had my own two real hardcopy tickets. I’m surprised nobody is stealing tickets like this as you always can find these numbers on the auction sites. Or maybe they are on the sly. Has anyone ever been refused at an entrance with printed tickets? They probably just blamed their seller but it could have been a randomer who just got the number, printed out new tickets and got to the venue early.

I think Ticketmaster should educate buyers more about how important the number is and to always pixelate when displaying online. Or they could have used a proprietary barcode format which would make cloning much more difficult.

Ross Ulbricht, alleged Silk Road founder, StoryCorps Interview with Rene? Pinnell

Just got a copyright strike on my Youtube account from the ‘Ross Ulbricht Legal Defense Fund LLC’ for an interview he did with a friend that I reuploaded to my account.


Now I’ve a copyright strike and all my videos are limited to 15 minutes. Pretty fucking pissed because if they just sent me a message on Youtube I would have gladly taken it down. So out of spite, I’m reuploading here:

Download link, save link as:

Forbes announce Ireland as best country for business – But it didn’t make the print magazine

There’s nothing Irish people like more than being told how great they are by outsiders and sure aren’t we the greatest little country on Earth to be sure. So the press release yesterday that Ireland topped the Forbes list of best countries to do business with was reprinted by nearly all of the national media and tweeted by so much of the Irish Twitterati that some had to filter it.

But Forbes must not have thought much of the list as it didn’t make their print edition! Maybe I’m mistaken but I downloaded the Dec 16th PDF and couldn’t find a reference to it anywhere. Download here yourself and have a look. Forbes seem to have a website with a combination of editorial pulled from their magazine and then random articles from contributors. Here’s an article that is in the Dec 16th issue. Note the ‘This story appears in the December 16, 2013 issue of Forbes.’ header at the top.

The Irish article doesn’t have this header. The quality of contributions that make the website but not the magazine is questionable. Here’s a website article claiming that the Third Space cafe in Smithfield is going to take down Starbucks.

So Forbes seems to be turning itself into a Buzzfeed style content farm. And one of the random stories that a writer might have made to hit his quota for the week has a whole nation patting itself on the back.

Tulsi Ennis & Golden Mill Ennis Menus

Right, bit of a random post but there’s two good takeaways in Ennis, County Clare that don’t have their menu anywhere on the Intertubes. I tried uploading a photo of the takeaway menus to Yelp but the image size was downsized so much the text was illegible. So I’m posting here. This is a personal blog, I can do what I like!

Click the images for the readable, full resolution versions.

Golden Mill Chinese

Tulsi Indian

MediaMonkey Playlist Creator Script

I’m going to the Forbidden Fruit music festival this weekend and for all gigs I like to do ‘homework’ on the bands and what sets they’re likely to play. That sounds like working to have fun but concerts are always better when you know the songs!

MediaMonkey is my music player of choice; one of the reasons being its powerful scripting functionality. So creating playlists from got boring enough that I decided to hack together a MediaMonkey script, extension, addon, plugin or whatever you want to call it to do it for me. Luckily most of the work was done for me and I just had to adapt the Loved Tracks Playlist Creator from psykar so 99% of the code is thanks to him.

Install the MMIP below and go to Tools -> Scripts -> Setlist FM Playlist Creator and enter a setlist URL like this one: A playlist should be created in this format: [Setlist] ArtistName – CityName (EventDate). A message will pop up if some songs weren’t found. Future upgrades of the script might tell you what album these missing songs are on. Download the MMIP below:

Download MediaMonkey Playlist Creator 1.0 MMIP

Make sure to have MediaMonkey running in administrator mode or you’ll get a “Product installation error”. For any other errors or feature requests, post as a comment below. If you like this script and it saves you time, please post a comment below telling me you use it. It’s disheartening to bother with something when you think nobody uses it!