Ticket #1382 (closed enhancement: fixed)
Streaming the output + saving to the local file
| Reported by: | burek | Owned by: | |
|---|---|---|---|
| Priority: | wish | Component: | avformat |
| Version: | git-master | Keywords: | tee |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
One way of streaming the output and saving the same output to a local file would be to use something like this (I guess):
ffmpeg -i <input> -vcodec libx264 udp://ip:port -vcodec libx264 local.mp4
but that way FFmpeg would use 2 (identical) encoders and consume twice the cpu than it is logically needed. It was suggested to me, by developers before, that I need some kind of source/sink implemented in ffmpeg to be able to do this. Recently, I figured an easy way to do this easier way:
ffmpeg -i <input> -vcodec libx264 -f mpegts - | ffmpeg -f mpegts -i - -vcodec copy local.mp4 -vcodec copy udp://bla:port
This way only 1 encoder is doing the encoding process and the rest is done using just "-vcodec copy", practically just muxing the content in different formats, as needed.
My question is: if this approach can be used to add a quick/simple option in ffmpeg to enable users to save the content to a local file while streaming it at the same time, something like this:
ffmpeg -i <input> -vcodec libx264 -localfile local.mp4 udp://bla:port
Change History
comment:2 follow-up: ↓ 3 Changed 3 months ago by cehoyos
- Keywords tee added
- Resolution set to fixed
- Status changed from new to closed
- Component changed from undetermined to avformat
I suspect the tee muxer by Nicolas George supports this feature (although I wonder why the last command line in the original report shouldn't work with older FFmpeg versions as well).



can't you split the stream using libavfilter?
the work around method is also described in more detail here: http://ffmpeg.org/trac/ffmpeg/wiki/Creating%20multiple%20outputs