How do I add a delay to a live stream sourced from webcam (v4l2) with FFMPEG?
up vote
0
down vote
favorite
How can I use FFMPEG to add a delay to a stream being sent from a (v4l2) webcam to a media server?
The use case here is something like a security camera where I want to be able to stream video to a server when something is detected in the video. The easiest way to ensure the event of interest is captured on the video is to use FFMPEG to stream from the camera to a virtual loopback device with an added delay. That loopback device can then be used to initiate live streaming when an even of interest occurs.
In GStreamer, I would accomplish a delay of this sort with the queue
element's min-threshold-time
parameter. For example the following (much-simplified) example pipeline adds a 2 second delay to the output coming from a v4l2 webcam before displaying it:
gst-launch-1.0 v4l2src device=/dev/video1 ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 min-threshold-time=2000000000 ! xvimagesink
How do I accomplish the same thing with FFMPEG? There are some technical challenges that prevent us from using GStreamer for this.
I have investigated the itsoffset
option for this, but as far as I can tell it is only usable for already-recorded files, and it is not clear what a good alternative would be.
ffmpeg video-streaming gstreamer v4l2loopback
add a comment |
up vote
0
down vote
favorite
How can I use FFMPEG to add a delay to a stream being sent from a (v4l2) webcam to a media server?
The use case here is something like a security camera where I want to be able to stream video to a server when something is detected in the video. The easiest way to ensure the event of interest is captured on the video is to use FFMPEG to stream from the camera to a virtual loopback device with an added delay. That loopback device can then be used to initiate live streaming when an even of interest occurs.
In GStreamer, I would accomplish a delay of this sort with the queue
element's min-threshold-time
parameter. For example the following (much-simplified) example pipeline adds a 2 second delay to the output coming from a v4l2 webcam before displaying it:
gst-launch-1.0 v4l2src device=/dev/video1 ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 min-threshold-time=2000000000 ! xvimagesink
How do I accomplish the same thing with FFMPEG? There are some technical challenges that prevent us from using GStreamer for this.
I have investigated the itsoffset
option for this, but as far as I can tell it is only usable for already-recorded files, and it is not clear what a good alternative would be.
ffmpeg video-streaming gstreamer v4l2loopback
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
How can I use FFMPEG to add a delay to a stream being sent from a (v4l2) webcam to a media server?
The use case here is something like a security camera where I want to be able to stream video to a server when something is detected in the video. The easiest way to ensure the event of interest is captured on the video is to use FFMPEG to stream from the camera to a virtual loopback device with an added delay. That loopback device can then be used to initiate live streaming when an even of interest occurs.
In GStreamer, I would accomplish a delay of this sort with the queue
element's min-threshold-time
parameter. For example the following (much-simplified) example pipeline adds a 2 second delay to the output coming from a v4l2 webcam before displaying it:
gst-launch-1.0 v4l2src device=/dev/video1 ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 min-threshold-time=2000000000 ! xvimagesink
How do I accomplish the same thing with FFMPEG? There are some technical challenges that prevent us from using GStreamer for this.
I have investigated the itsoffset
option for this, but as far as I can tell it is only usable for already-recorded files, and it is not clear what a good alternative would be.
ffmpeg video-streaming gstreamer v4l2loopback
How can I use FFMPEG to add a delay to a stream being sent from a (v4l2) webcam to a media server?
The use case here is something like a security camera where I want to be able to stream video to a server when something is detected in the video. The easiest way to ensure the event of interest is captured on the video is to use FFMPEG to stream from the camera to a virtual loopback device with an added delay. That loopback device can then be used to initiate live streaming when an even of interest occurs.
In GStreamer, I would accomplish a delay of this sort with the queue
element's min-threshold-time
parameter. For example the following (much-simplified) example pipeline adds a 2 second delay to the output coming from a v4l2 webcam before displaying it:
gst-launch-1.0 v4l2src device=/dev/video1 ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 min-threshold-time=2000000000 ! xvimagesink
How do I accomplish the same thing with FFMPEG? There are some technical challenges that prevent us from using GStreamer for this.
I have investigated the itsoffset
option for this, but as far as I can tell it is only usable for already-recorded files, and it is not clear what a good alternative would be.
ffmpeg video-streaming gstreamer v4l2loopback
ffmpeg video-streaming gstreamer v4l2loopback
asked Nov 19 at 22:09
David
32
32
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
With a recent git build of ffmpeg, basic template is
ffmpeg -i input -vf tpad=start_duration=5 -af adelay=5000|5000 stream-out
The tpad
filter will add 5 seconds of black at the start of the video stream, and the apad filter will add 5000 milliseconds of silence to the first two channels of the audio.
Thanks, this worked perfectly! How serendipitous that this filter just made it into master a few weeks ago (by my reading of the FFMPEG listservs). Are there any sources to which one can subscribe to see these kinds of new features without being exposed to the full torrent of development-related conversation?
– David
Nov 21 at 17:59
lists.ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
– Gyan
Nov 21 at 18:14
Thanks for everything here, you've been extremely helpful.
– David
Nov 21 at 20:35
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
With a recent git build of ffmpeg, basic template is
ffmpeg -i input -vf tpad=start_duration=5 -af adelay=5000|5000 stream-out
The tpad
filter will add 5 seconds of black at the start of the video stream, and the apad filter will add 5000 milliseconds of silence to the first two channels of the audio.
Thanks, this worked perfectly! How serendipitous that this filter just made it into master a few weeks ago (by my reading of the FFMPEG listservs). Are there any sources to which one can subscribe to see these kinds of new features without being exposed to the full torrent of development-related conversation?
– David
Nov 21 at 17:59
lists.ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
– Gyan
Nov 21 at 18:14
Thanks for everything here, you've been extremely helpful.
– David
Nov 21 at 20:35
add a comment |
up vote
1
down vote
accepted
With a recent git build of ffmpeg, basic template is
ffmpeg -i input -vf tpad=start_duration=5 -af adelay=5000|5000 stream-out
The tpad
filter will add 5 seconds of black at the start of the video stream, and the apad filter will add 5000 milliseconds of silence to the first two channels of the audio.
Thanks, this worked perfectly! How serendipitous that this filter just made it into master a few weeks ago (by my reading of the FFMPEG listservs). Are there any sources to which one can subscribe to see these kinds of new features without being exposed to the full torrent of development-related conversation?
– David
Nov 21 at 17:59
lists.ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
– Gyan
Nov 21 at 18:14
Thanks for everything here, you've been extremely helpful.
– David
Nov 21 at 20:35
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
With a recent git build of ffmpeg, basic template is
ffmpeg -i input -vf tpad=start_duration=5 -af adelay=5000|5000 stream-out
The tpad
filter will add 5 seconds of black at the start of the video stream, and the apad filter will add 5000 milliseconds of silence to the first two channels of the audio.
With a recent git build of ffmpeg, basic template is
ffmpeg -i input -vf tpad=start_duration=5 -af adelay=5000|5000 stream-out
The tpad
filter will add 5 seconds of black at the start of the video stream, and the apad filter will add 5000 milliseconds of silence to the first two channels of the audio.
answered Nov 20 at 5:39
Gyan
30.1k22566
30.1k22566
Thanks, this worked perfectly! How serendipitous that this filter just made it into master a few weeks ago (by my reading of the FFMPEG listservs). Are there any sources to which one can subscribe to see these kinds of new features without being exposed to the full torrent of development-related conversation?
– David
Nov 21 at 17:59
lists.ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
– Gyan
Nov 21 at 18:14
Thanks for everything here, you've been extremely helpful.
– David
Nov 21 at 20:35
add a comment |
Thanks, this worked perfectly! How serendipitous that this filter just made it into master a few weeks ago (by my reading of the FFMPEG listservs). Are there any sources to which one can subscribe to see these kinds of new features without being exposed to the full torrent of development-related conversation?
– David
Nov 21 at 17:59
lists.ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
– Gyan
Nov 21 at 18:14
Thanks for everything here, you've been extremely helpful.
– David
Nov 21 at 20:35
Thanks, this worked perfectly! How serendipitous that this filter just made it into master a few weeks ago (by my reading of the FFMPEG listservs). Are there any sources to which one can subscribe to see these kinds of new features without being exposed to the full torrent of development-related conversation?
– David
Nov 21 at 17:59
Thanks, this worked perfectly! How serendipitous that this filter just made it into master a few weeks ago (by my reading of the FFMPEG listservs). Are there any sources to which one can subscribe to see these kinds of new features without being exposed to the full torrent of development-related conversation?
– David
Nov 21 at 17:59
lists.ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
– Gyan
Nov 21 at 18:14
lists.ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
– Gyan
Nov 21 at 18:14
Thanks for everything here, you've been extremely helpful.
– David
Nov 21 at 20:35
Thanks for everything here, you've been extremely helpful.
– David
Nov 21 at 20:35
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53383354%2fhow-do-i-add-a-delay-to-a-live-stream-sourced-from-webcam-v4l2-with-ffmpeg%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown