#!/bin/bash

youtube-dl -F "$1"
printf "Choose the audio format: "
read afmt
printf "Choose the video format: "
read vfmt

audio=$(youtube-dl -f "${afmt}" -g "$1")
video=$(youtube-dl -f "${vfmt}" -g "$1")
title=$(youtube-dl -e "$1")

ffmpeg -i "${audio}" -i "${video}" -f matroska -c:a copy -c:v copy "$title.mkv"
exit 0
