Skip to content

Instantly share code, notes, and snippets.

@youandhubris
Last active March 8, 2022 14:47
Show Gist options
  • Save youandhubris/0f7b46e33440edb857a86b80c801f21f to your computer and use it in GitHub Desktop.
Save youandhubris/0f7b46e33440edb857a86b80c801f21f to your computer and use it in GitHub Desktop.
FFmpeg & FFprobe

Convert

To HAP Alpha

ffmpeg -i in.mp4 -vcodec hap -format hap_alpha out.mov

To HEVC (x265) GPU

ffmpeg -hwaccel cuvid -i in.mkv -c:v hevc_nvenc -preset slow -b:v 8M -maxrate:v 8.5M -pix_fmt yuv420p out.mkv



Extract

Aiff from H264

ffmpeg -i in.mp4 out.aiff



Probe

ffprobe -i in.mkv -show_format -hide_banner



Other

Concat SRT

ffmpeg -i "concat:in-0.srt|in-1.srt" -c copy out.srt

Mapping (Convert Video, copy Audio and Subtitles)

ffmpeg -i in.mkv -map 0:0 -map 0:2 -map 0:30 -c:v hap -format hap_alpha -c:a copy -c:s copy out.mkv

Remove Chapters

-map_chapters -1

Trim without encoding

-ss 00:00:00 -t 00:00:03 1st timecode: start time / 2nd timecode;

'too many packets buffered for output' bug

-max_muxing_queue_size 1024



Examples

To HEVC with chapter selection and max muxing

ffmpeg -hwaccel cuvid -i in.mkv -max_muxing_queue_size 1024 -map 0:0 -map 0:30 -map 0:31 -c:v hevc_nvenc -preset slow -b:v 8M -maxrate:v 8.5M -pix_fmt yuv420p -c:a copy -c:s copy -map_chapters -1 out.x265-Hubris.mkv

Trim without encoding

ffmpeg -i in.mov -ss 00:00:00 -t 00:00:03 -async 1 -c copy out.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment