[FFmpeg-user] Read ffmpeg segment on stdout

Moritz Barsnick barsnick at gmx.net
Wed Nov 1 00:27:42 EET 2017


On Tue, Oct 31, 2017 at 01:55:49 +0100, Alberto Esposito wrote:

> but if I enable segmentation it doesn't work:
[...]
> Output #0, segment, to 'pipe:1':
> Output file #0 does not contain any stream

For some reason, the segment muxer requires you to map something
explicitly. Add "-map 0" (or whatever streams you want) and that error
should go away.

> 1) Can segmented files be written to stdout? Is there a special character
> for file separation?

Eh, no. The point of the segment muxer is to split up the stream into
separate files. It takes a filename template to name those files, and
can therefore not write to special files such as pipes. (Protocols such
as ftp should work, I believe that was changed a while ago.)

What does your browser do? Do you have a special JavaScript (or
something) implementation which reads the segments and displays them?

What are you actually trying to do?

> 2) Otherwise, how can I detect a new keyframe just by reading the byte
> stream?

You mean from a non-segmented stream? First, the important question:
What for? (The answer to your question is: It depends on the codec,
possibly on the container, I would say.)

For streaming to a browser, I would say HLS is the best solution. Serve
up the listfile (m3u8) and the segments from a werserver, or directly
from disk.

Moritz


More information about the ffmpeg-user mailing list