Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#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 (3)

comment:1 by Roger Pack, 12 years ago

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

Last edited 11 years ago by Roger Pack (previous) (diff)

comment:2 by Carl Eugen Hoyos, 11 years ago

Component: undeterminedavformat
Keywords: tee added
Resolution: fixed
Status: newclosed

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).

in reply to:  2 comment:3 by Carl Eugen Hoyos, 11 years ago

Replying to cehoyos:

although I wonder why the last command line in the original report shouldn't work with older FFmpeg versions as well.

Ignore that, I initially misread the original post.

Note: See TracTickets for help on using tickets.