britalmeida / push_to_talk

Add-on for recording audio in Blender's Sequencer
GNU General Public License v3.0
47 stars 11 forks source link

Specify file buffer size and flush data to disk as soon as possible #16

Closed DarkDefender closed 11 months ago

DarkDefender commented 12 months ago

Without specifying the buffer size, ffmpeg will try to determine the best buffersize and will usually pick a big value to minimize how often it writes to disk.

By specifying a small value and forcing on "flush_packets", ffmpeg will write the recorded data back to disk ASAP.

This makes it so there is very little data loss when stopping the recording.

Closes #4

britalmeida commented 12 months ago

This is really really appreciated, ty!

Some questions:

DarkDefender commented 12 months ago

Ah, sorry. I should have mentioned those points in the initial post.

Why removing the framerate argument?

This option only does something when creating or handling a video file. From https://ffmpeg.org/ffmpeg-formats.html#image2-1: "Set the frame rate for the video stream. It defaults to 25."

It can also be used to limit how often images of a video stream is saved to disk (see the "x11grab" example on that page)

However as we are only dealing with audio streams here, that option is not doing anything.

This was tested on.. linux?

That is correct. I tested briefly on mac as well.

britalmeida commented 11 months ago

@DarkDefender Thank you very much! This is a super nice and sensible well explained fix to an annoying longstanding issue going deep in ffmpeg options. Patch very welcomed ^^