Tips and tricks

YouTube Download - How to have a local command to download movies
Install youtube dl
Get the list of qualities
yt-dlp -F [[YOUTUBE_ID]]

Complete script:
#!/usr/bin/env bash
# Script: merge_video_audio.sh
# Description: Prompts for two IDs, two formats, downloads them, and merges using ffmpeg.
# Prompt the user for the first ID
echo "Enter the first ID (video source) or URL:"
read FIRST_ID
# List available formats for the first ID
yt-dlp "$FIRST_ID" --list-formats
# Prompt the user to select a format for the first ID
echo "Enter the format code for the first ID (video):"
read FIRST_FORMAT
# Download the first ID as vtemp.mp4 using the chosen format
yt-dlp -i -f "$FIRST_FORMAT" "$FIRST_ID" -o "vtemp.mp4"
# Prompt the user to select a format for the second ID
echo "Enter the format code for the second ID (audio):"
read SECOND_FORMAT
# Download the second ID as vtemp.m4a using the chosen format
yt-dlp -i -f "$SECOND_FORMAT" "$FIRST_ID" -o "vtemp.m4a"
# Merge video and audio into output.mp4 using ffmpeg
ffmpeg -i vtemp.mp4 -i vtemp.m4a -c copy output.mp4
# Cleanup prompt (optional)
echo "Merging complete. The merged file is 'output.mp4'."
# Optionally, you might want to remove vtemp files if no longer needed:
# rm vtemp.mp4 vtemp.m4a
First Step
In the first step, you choose the ID of youtube video.
Second Step – Audio and Video Sources
Here you choose the video and audio format.
I would choose something like -> 136 mp4 1280x720 30 │ 42.80MiB 2098k https │ avc1.64001f 2098k video only 720p, mp4_dash
<- in the second step ( audio ) I would choose something like -> 140 m4a audio only 2 │ 2.64MiB 130k https │ audio only mp4a.40.2 130k 44k [es] medium, m4a_dash
<-
Final Step – Merging and Cleaning up
This is merging the audio and video files. -> ffmpeg -i vtemp.mp4 -i vtemp.m4a -c copy output.mp4
( you need ffmpeg ) <-And you can clean up by removing the temp files as well.