-
Notifications
You must be signed in to change notification settings - Fork 5
video production Notes
- Working with Aspect Ratios
- Working with Blender as a Video Editor
- Avidemux
- ffmpeg
- Working with mpv
- Working with mkv files
- Useful Links
- TODOs
To calculate the aspect ratio of a screen given the resolution of a screen, ie. my MacBook Pro 2013; width = 1440 pixels @ 2x | height = 900 pixels @ 2x
- Divide the width by the height
Ex
1440 / 900 = 1.616 / 10 = 1.6Another way of saying the aspect ratio is that the screen is 16 by 10
A decent video for calculating aspect ratios here
Blender can be used not only as a 3D animation / modeling program but also has support for editing video based files, ie. raw mpeg files, DVD mpeg 2 files, and so on.
Blender stores its configuration directory, ie. Blender in different paths based on the system that Blender is running on, ie. if running Blender on macOS as a standard user, then Blender will store its configuration files in $HOME/Library/Application\ Support/Blender, whereas on most GNU+Linux distros, Blender will store it's configuration directory / files in $XDG_CONFIG_HOME, ie. $HOME/.config/Blender.
In short, avidemux is a great lightweight utility for trimming the beginning and ending of a a video clip / movie, ie. if one has recorded a screencast using OBS, and wants to remove the first and end three seconds of the clip avidemux is a great tool for this task, and does not transcode the video.
To install ffmpeg with all the goodies π© π₯ πͺ
brew install ffmpeg --with-tools --with-fdk-aac --with-libvpx --with-x265 --HEADTo transcode a x265 HEV1 encoded video file
ffmpeg -i input.MOV -filter:v scale=1280:-1 -r 30 -c:v libx265 -crf 21 -c:a aac -b:a 128k -f mp4 -pix_fmt yuv420p -tag:v hvc1 -movflags faststart output.mp4To transcode a video from one container format to another, ie. from .mkv to .mp4
ffmpeg -i input.mkv -codec copy output.mp4To transcode an audio file from codec to another, ie. Microsoft WAV to mp3
ffmpeg -i input.wav -vn -ar 44100 -ac 2 -ab 192k -f mp3 output.mp3To extract an audio stream from a audio video interlieved file
ffmpeg -i input.avi -vn -acoded copy output.mp3The above command will NOT transcode the stream and keep the audio stream in the same codec.
To combine multiple video files into one output file
echo file file1.mp4 > list.txt
echo file file2.mp4 >> list.txt
echo file file3.mp4 >> list.txt
echo file file4.mp4 >> list.txtConcatenate the files into one continuos file
ffmpeg -f concat -i list.txt -c copy output.mp4A use case that I have quickly come across is being able to record an audio stream playing through the system audio on macOS, ie. when I listen to a YouTube stream in my terminal using mpv. Ideally I would want to record the audio stream in it's native codec to avoid real-time or transcoding on the fly to minimize CPU usage when recording a stream. ffmpeg is a great tool for recording audio via the command line.
To list available sources that ffmpeg can record from on macOS
ffmpeg -f avfoundation -list_devices true -i ""To list available capture devices on different OS's such as Windows or Linux see
After displaying the capturing devices use ffmpeg to select a capture device and begin recording the stream from the system audio.
For my particular use case mpv decodes YouTube live streams on macOS using an aac audio codec, so I would want to record the stream using an aac codec on my system. Also, as opposed to recording the output of the speakers playing the audio, which would be a "turrible" idea, I route my audio through app known as Background Music on macOS which is quite magical π΄ to say the least, so I'm able to record the audio stream being funneled into Background Music using ffmepg with minimal to no audio degredation.
To capture only audio being streamed through Background Music
ffmpeg -f avfoundation -i ":0" /path/to/recording.aacffmpeg will require a known audio file extension in order to capture the audio.
To play a audio & video file, but not play the video portion of the file, ie. just decode and play the audio portion of the file.
mpv --vid=no /path/to/media/file.{mkv,mp4}To control the volume output of the audio in mpv via CLI
9 or 0
The main difference between hardware decoding vs. software decoding is that hardware decoding decompresses the binary blob of data, ie. the video file directly on the video card, where as with software decoding it is to my understanding that the binary blob of data will be decompressed via the CPU and then moved onto the GPU, ie. the decompressing of the video / blob of data does not happen on the GPU.
To print a list of video output drivers accessible to mpv
mpv --vo=helpOn macOs put
vo=gpuin~/.config/mpv/mpv.conf
To print a list of hardware, ie. GPU accelerated decoding codecs
mpv --hwdec=helpOn macOS put
hwdec=videotoolboxin~/.config/mpv/mpv.conf
Running mpv on Linux, and using hardware acceleration will obviously require different settings. π€·
To troubleshoot the below warning / error message on macOS add the below config settings.
Not trying to use hardware decoding: codec h264 is not on whitelist, or does not support hardware acceleration.mpv.conf settings macOS specific
vo=gpu
hwdec=videotoolboxTo start vlc with logging
vlc --verbose=2 --file-logging --logfile=/path/to/vlc.logMKVToolNix provides great tools for working with the matroska container format for multimedia files. It allows features such as adding additional subtitile tracks to existing mkv file.
ScreenStudio requires JRE >= 8.0 π¬
If you find any of this info helpful on your journey π click that π βοΈ star button. It sure makes me feel warm and fuzzy π» on the inside.
-
Linux and macOS Operation Notes
- β macOS Op Notes
- π§ Linux Op Notes
- Vim & Neovim Notes
- git Notes
- π fish shell Notes
- ECMAScript Tooling
- π₯§ Raspberry Pi Notes
- asdf version manager Notes
- Bind9 Notes
- Creating a custom motd on Debian Jessie
- ECMAScript Tooling
- Email client Notes
- Email Server Setup Notes Postfix & Dovecot
- Emoji side quest
- fish shell Notes
- π₯ π€ git it got it good Notes
- git Notes
- Graphics and Image Processing Notes
- GUI text editor Notes
- π»π§ Homebrew and Linuxbrew formula Notes
- Linux and macOS Administration Notes
- Linux and macOS Troubleshooting Notes
- MacBook Pro Late 2013 Notes
- Vim & Neovim Notes
- Video Production Notes
- Python Notes
- radare Notes
- Raspberry Pi Notes
- Terminal Emulators
- Tmux Notes
- Web Browser Notes
- Weechat Notes
- Microsoft Windows Notes