[FFmpeg-user] Encoding raw data written in real time into vorbis?

Moritz Barsnick barsnick at gmx.net
Thu Dec 8 16:17:32 EET 2016


On Tue, Dec 06, 2016 at 22:17:55 +0100, Edgar H wrote:

> I have a Java application which writes into a file without extension all
> the bytes that are read from a given mixer in the system. Those raw bytes
> should be encoded into a .ogg file so that it can be sent in real time to
> Icecast and stream it to the net.

You could just pipe these chunks to ffmpeg's stdin:

$ whatever_throws_the_chunks | ffmpeg -f s16le -ar 48000 -ac 2 -i - -f ogg rtmp://stream_url

> And another possible solution that I don't know if it's possible... Writing
> constantly all the bytes into the file, open ffmpeg in another thread and
> encode the file which is being written in real time to .ogg?

That's basically what I'm suggesting. I don't see the point of encoding
individual chunks, just to concatenate them afterwards. The problem
with an intermediate file is that if ffmpeg encodes faster than it is
filled, ffmpeg will reach EOF and stop. Using a pipe as above or a
named pipe is preferable. (Using "-re" as an input option may avoid
this.)

hope this helps,
Moritz


More information about the ffmpeg-user mailing list