Last active
April 9, 2019 18:03
-
-
Save pastacolsugo/69782f3c5b5615a2d444a7af2e24dd06 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MAC OSX Hardware Acceleration is made through VideoToolbox | |
ffmpeg [...] -hwaccel videotoolbox [...] | |
ffmpeg [...] -c:v h264_videotoolbox [...] | |
# Obtain codec list | |
ffmpeg -codecs | |
# Set framerate (IMPORTANT! Always specify on input stream, otherwise could default to 1000kfps and it's bad) | |
ffmpeg [...] -framerate 30 [...] | |
# Show capture devices | |
ffmpeg -f avfoundation -list_devices true -i "" | |
# Capture WITHOUT compression (note: no-hwaccel) | |
ffmpeg [...] -c:v libx264 -crf 0 -preset ultrafast output.mkv | |
# Re-encode WITH compression later (note: no hw-accel) | |
ffmpeg -i output.mkv -c:v libx264 -crf 0 -preset veryslow output-smaller.mkv | |
# Take a screenshot of the video input device to correctly identify the source (no audio) | |
ffmpeg -f avfoundation -framerate 1 -t 1 -pix_fmt yuv420p -i "1" -frames:v 1 screenshot.jpg | |
# BAD -> hwacceleration sucks, QC35 audio sucks too, pixel format incorrect | |
# Record with no compression and hw-acceleration (note: -crf 0 = lossless) | |
# From screen and Bose QC35 over BT | |
ffmpeg -f avfoundation -framerate 30 -pix_fmt yuv420p -i "1:0" -c:v h264_videotoolbox -crf 0 -preset ultrafast output.mkv | |
| | |
NEW VERSION | |
| | |
V | |
# RECORD with no compression and integrated mic audio | |
# TODO: check framerate (30 for code is overkill) and audio input | |
ffmpeg -f avfoundation -framerate 30 -pix_fmt yuyv422 -i "1:1" -crf 0 -preset ultrafast test-pixel-format.mkv | |
# Re-encode later with hw-acceleration (note: -crf 0 = lossless) | |
ffmpeg -i output.mkv -c:v h264_videotoolbox -crf 0 -preset veryslow output-smaller.mkv | |
# Print file metadata etc. | |
ffmpeg -i path/to/file.ext | |
# Convert all m4a files to mp3 | |
for f in *.m4a; do ffmpeg -i "$f" -acodec libmp3lame -vn -b:a 320k "${f%.m4a}.mp3"; done | |
# Convert video from .foo to .bar | |
# -g : GOP, for searchability | |
ffmpeg -i input.foo -vcodec bar -acodec baz -b:v 21000k -b:a 320k -g 150 -threads 4 output.bar | |
# Convert image sequence to video | |
ffmpeg -r 18 -pattern_type glob -i '*.png' -b:v 21000k -s hd1080 -vcodec vp9 -an -pix_fmt yuv420p -deinterlace output.ext | |
# Combine video and audio into one file | |
ffmpeg -i video.ext -i audio.ext -c:v copy -c:a copy output.ext | |
# Listen to 10 seconds of audio from a video file | |
# | |
# -ss : start time | |
# -t : seconds to cut | |
# -autoexit : closes ffplay as soon as the audio finishes | |
ffmpeg -ss 00:34:24.85 -t 10 -i path/to/file.mp4 -f mp3 pipe:play | ffplay -i pipe:play -autoexit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment