Ticket #1753 (new enhancement)
Delay output for X seconds
| Reported by: | burek | Owned by: | |
|---|---|---|---|
| Priority: | wish | Component: | undetermined |
| Version: | unspecified | Keywords: | |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
It would be nice to add a feature where the output could be delayed for certain amount of time (specified in seconds or hh:mm:ss.mmm). One use case for this might be the case where we want to capture the video, only when a certain event occurs (like lightning bolt, robbery or trespassing for example). If we start capturing the output at that exact moment, we might loose some valuable time, but if the output was buffered, then capturing would start in the past, enabling people to record an important event.
How to make use of the feature?
Start one ffmpeg to capture and buffer the webcam input (the output will start after 10 seconds and will continue real-time, always being late for 10 seconds, comparing to the current time):
ffmpeg -f v4l2 -i /dev/video0 -vf delay 10 -af delay 10 -f mpegts udp://localhost:1234
Start another ffmpeg only when some important event occurs (triggered by the sensor or something similar):
ffmpeg -f mpegts -i udp://localhost:1234 -map 0 -c copy capture.avi
Obviously capture.avi will start recording from the past, considering the current time the event was triggered, which will allow the beginning of the event to get recorded as well.
Change History
comment:2 Changed 8 months ago by burek
If this is not viable to implement at the filter level, then it might be done as an output option "-delay <seconds>" to be used like this:
ffmpeg -f v4l2 -i /dev/video0 -delay 10 -f mpegts udp://localhost:1234
The expected result should be that the output is always 10 seconds late in comparison to the input.



I can't edit the original text, but there is a mistake. Instead of "-vf delay 10 -af delay 10" it should say "-vf delay=10 -af delay=10"