Opened 5 years ago

Closed 4 years ago

Last modified 4 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 Changed 4 years ago by rogerdpack

can't you split the stream using libavfilter?

Version 0, edited 4 years ago by rogerdpack (next)

comment:2 follow-up: Changed 4 years ago by cehoyos

  • Component changed from undetermined to avformat
  • Keywords tee added
  • Resolution set to fixed
  • Status changed from new to closed

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

comment:3 in reply to: ↑ 2 Changed 4 years ago by cehoyos

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.