Skip to content

Instantly share code, notes, and snippets.

@kuntau
Created November 2, 2025 01:12
Show Gist options
  • Select an option

  • Save kuntau/8407db2293d43c5469efb1a834dc5b48 to your computer and use it in GitHub Desktop.

Select an option

Save kuntau/8407db2293d43c5469efb1a834dc5b48 to your computer and use it in GitHub Desktop.
Convert all FLV files in a folder to MP4 using ffmpeg with hardware acceleration (VideoToolbox), matching each file’s original bitrate.
# `-tag:v hvc1` to make sure we can use Quick Look and generate videos thumbnail
for f in *.flv; do ffmpeg -hwaccel videotoolbox -i "$f" -c:v hevc_videotoolbox -tag:v hvc1 -b:v $(ffprobe -v error -select_streams v:0 -show_entries stream=bit_rate -of csv=p=0 "$f") -c:a copy "${f%.flv}.mp4"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment