This is a roundup of miscellaneous things that I’ve found out about (or have rediscovered). I take notes on findings regularly, and I put the findings that translate well to speech on my podcast, Small Findings. The rest (which are often technical findings), I put here. They’re not always written up for maximum comprehension as a blog post, but if anything is hard to understand, please email me if you need clarification.
“Too many packets” ffmpeg error
When ffmpeg says “Too many packets buffered for output stream 0:1”, it means it literally. You can increase the buffer size with this switch:
-max_muxing_queue_size 1024
(Substitute the size you need.) After that, it may be able to buffer all of the packets.
That argument needs to go before the output file in the command, though, or there will be complaints. This works, for example, but it won’t work if you put max_muxing_queue_size
before -i.
ffmpeg -i demo.ogv -max_muxing_queue_size 1024 demo.mp4
#video
#ffmpeg
#command
#error
Extracting audio from a video
ffmpeg -i undefined.ogv -vn -acodec copy out.ogg
Another example:
ffmpeg -i unfortunate-day.mov -vn -acodec copy out.aac
-vn
tells ffmpeg to skip video in the output.
-acodec
tells it to set the audio codec in the output, so that players know how to play it.
copy
tells it to copy the output to the following file.
You can’t have it convert the audio format while it’s extracting the audio as far as I know. If the audio stream is encoded as ogg, then you can extract ogg. If it’s encoded as AAC, then you can extract AAC.
#audio #video #ffmpeg
Extracting a still from a video
Use ffmpeg with the -frames:v 1
switch to tell it to grab a single frome and a jpg filename as the output to tell it to write it to an image file.
You can add -ss <seconds into the video>
to tell it where in the video to get the frame from. You can specify jpeg quality -qscale:v <2-31>
, with 2 being the highest quality.
Example:
ffmpeg -ss 0 -i source-images/Video\ Apr\ 17,\ 5\ 49\ 56\ PM.mov -qscale:v 4 -frames:v 1 output.jpg
Links: - name: Stack Overflow url: https://stackoverflow.com/questions/10225403/how-can-i-extract-a-good-quality-jpeg-image-from-an-h264-video-file-with-ffmpeg
#video
#editing
#ffmpeg
Converting video formats
In many cases, it’s sufficient to just pass filenames with different file extensions to ffmpeg, like this:
ffmpeg -i in.ogv out.mp4
It will use the container format corresponding to the file extensions to pick appropriate default encoders. (e.g. libx264 and aac for mp4)
See also:
#ffmpeg
#formats
#video