Is there any way ffmpeg send video to /dev/video0 on Ubuntu?












2















I want to send video to webcam device on Ubuntu which is loaded on /dev/video0



I've already seen this command that send desktop to it but is there any way to send video to it?




ffmpeg -f x11grab -r 15 -s 1280x720 -i :0.0+0,0 -vcodec rawvideo
-pix_fmt yuv420p -threads 0 -f v4l2 /dev/video0




I should mention that i specifically want to use ffmpeg command.










share|improve this question























  • It's my understanding that a webcam is an video input device so I would say no. What webcam do you have that supports receiving video?

    – Elder Geek
    Feb 8 '17 at 19:12











  • @ElderGeek there is no webcam.it is virtual one which need to have video on it.

    – dsddd
    Feb 8 '17 at 19:15











  • HAve you tried using a pipe?

    – Elder Geek
    Feb 8 '17 at 19:25











  • Information is available here

    – Elder Geek
    Feb 8 '17 at 19:29






  • 1





    Possible duplicate of Fake a webcam using a video loopback device? (although not necessarily using ffmpeg).

    – llogan
    Feb 8 '17 at 19:39


















2















I want to send video to webcam device on Ubuntu which is loaded on /dev/video0



I've already seen this command that send desktop to it but is there any way to send video to it?




ffmpeg -f x11grab -r 15 -s 1280x720 -i :0.0+0,0 -vcodec rawvideo
-pix_fmt yuv420p -threads 0 -f v4l2 /dev/video0




I should mention that i specifically want to use ffmpeg command.










share|improve this question























  • It's my understanding that a webcam is an video input device so I would say no. What webcam do you have that supports receiving video?

    – Elder Geek
    Feb 8 '17 at 19:12











  • @ElderGeek there is no webcam.it is virtual one which need to have video on it.

    – dsddd
    Feb 8 '17 at 19:15











  • HAve you tried using a pipe?

    – Elder Geek
    Feb 8 '17 at 19:25











  • Information is available here

    – Elder Geek
    Feb 8 '17 at 19:29






  • 1





    Possible duplicate of Fake a webcam using a video loopback device? (although not necessarily using ffmpeg).

    – llogan
    Feb 8 '17 at 19:39
















2












2








2


3






I want to send video to webcam device on Ubuntu which is loaded on /dev/video0



I've already seen this command that send desktop to it but is there any way to send video to it?




ffmpeg -f x11grab -r 15 -s 1280x720 -i :0.0+0,0 -vcodec rawvideo
-pix_fmt yuv420p -threads 0 -f v4l2 /dev/video0




I should mention that i specifically want to use ffmpeg command.










share|improve this question














I want to send video to webcam device on Ubuntu which is loaded on /dev/video0



I've already seen this command that send desktop to it but is there any way to send video to it?




ffmpeg -f x11grab -r 15 -s 1280x720 -i :0.0+0,0 -vcodec rawvideo
-pix_fmt yuv420p -threads 0 -f v4l2 /dev/video0




I should mention that i specifically want to use ffmpeg command.







ffmpeg






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 8 '17 at 19:06









dsddddsddd

1313




1313













  • It's my understanding that a webcam is an video input device so I would say no. What webcam do you have that supports receiving video?

    – Elder Geek
    Feb 8 '17 at 19:12











  • @ElderGeek there is no webcam.it is virtual one which need to have video on it.

    – dsddd
    Feb 8 '17 at 19:15











  • HAve you tried using a pipe?

    – Elder Geek
    Feb 8 '17 at 19:25











  • Information is available here

    – Elder Geek
    Feb 8 '17 at 19:29






  • 1





    Possible duplicate of Fake a webcam using a video loopback device? (although not necessarily using ffmpeg).

    – llogan
    Feb 8 '17 at 19:39





















  • It's my understanding that a webcam is an video input device so I would say no. What webcam do you have that supports receiving video?

    – Elder Geek
    Feb 8 '17 at 19:12











  • @ElderGeek there is no webcam.it is virtual one which need to have video on it.

    – dsddd
    Feb 8 '17 at 19:15











  • HAve you tried using a pipe?

    – Elder Geek
    Feb 8 '17 at 19:25











  • Information is available here

    – Elder Geek
    Feb 8 '17 at 19:29






  • 1





    Possible duplicate of Fake a webcam using a video loopback device? (although not necessarily using ffmpeg).

    – llogan
    Feb 8 '17 at 19:39



















It's my understanding that a webcam is an video input device so I would say no. What webcam do you have that supports receiving video?

– Elder Geek
Feb 8 '17 at 19:12





It's my understanding that a webcam is an video input device so I would say no. What webcam do you have that supports receiving video?

– Elder Geek
Feb 8 '17 at 19:12













@ElderGeek there is no webcam.it is virtual one which need to have video on it.

– dsddd
Feb 8 '17 at 19:15





@ElderGeek there is no webcam.it is virtual one which need to have video on it.

– dsddd
Feb 8 '17 at 19:15













HAve you tried using a pipe?

– Elder Geek
Feb 8 '17 at 19:25





HAve you tried using a pipe?

– Elder Geek
Feb 8 '17 at 19:25













Information is available here

– Elder Geek
Feb 8 '17 at 19:29





Information is available here

– Elder Geek
Feb 8 '17 at 19:29




1




1





Possible duplicate of Fake a webcam using a video loopback device? (although not necessarily using ffmpeg).

– llogan
Feb 8 '17 at 19:39







Possible duplicate of Fake a webcam using a video loopback device? (although not necessarily using ffmpeg).

– llogan
Feb 8 '17 at 19:39












1 Answer
1






active

oldest

votes


















6














You can do this with v4l2loopback. First you need to install it:



Install v4l2loopback



Easy: Install v4l2loopback from the repository



sudo apt install v4l2loopback-dkms
sudo modprobe v4l2loopback


Hard: Compile v4l2loopback



If it's not in the repository for your Ubuntu version you can compile it:



sudo apt-get install build-essential checkinstall
wget https://github.com/umlaeute/v4l2loopback/archive/master.zip
unzip master.zip
cd v4l2loopback-master
make
sudo checkinstall --pkgname=v4l2loopback --pkgversion="$(date +%Y%m%d%H%M)-git" --default
sudo modprobe v4l2loopback


Uninstalling



If you want to remove the package you compiled:



sudo apt-get remove v4l2loopback




Usage examples



Now run ffmpeg. Example for desktop:



ffmpeg -f x11grab -framerate 15 -video_size 1280x720 -i :0.0 -f v4l2 /dev/video0


Example for a video input:



ffmpeg -re -i input.mp4 -map 0:v -f v4l2 /dev/video0


You can view it with ffplay:



ffplay /dev/video0


Note that the actual video number may vary depending if an existing device is already using /dev/video0.






share|improve this answer


























  • where can i specify my video ?

    – dsddd
    Feb 8 '17 at 21:08













  • @dsddd Example updated.

    – llogan
    Feb 8 '17 at 21:13











  • I installed the package, but I'm stuck with an error on both examples, either the x11grab or the the mp4 video give me the same [v4l2 @ 0x55ebc0cfdc40] ioctl(VIDIOC_G_FMT): Invalid argument Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Error initializing output stream 0:0 -- Conversion failed! Is there something else I should do? some dependencies I missed?

    – Sabbin
    Jan 29 at 16:43













  • @Sabbin Please show your command and provide a link to a pastebin of the log.

    – llogan
    Jan 30 at 22:27











  • @llogan following your example above, I have this command ffmpeg -re -i 1.mp4 -map 0:v -f v4l2 /dev/video0 pastebin.com/9eDK0NTN, if I try the command to run for desktop ffmpeg -f x11grab -framerate 15 -video_size 1280x720 -i :1 -f v4l2 /dev/video0 I get this error pastebin.com/xN6uZJR6, also the folder /dev/video0 has rights for write

    – Sabbin
    Feb 4 at 7:37













Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f881305%2fis-there-any-way-ffmpeg-send-video-to-dev-video0-on-ubuntu%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









6














You can do this with v4l2loopback. First you need to install it:



Install v4l2loopback



Easy: Install v4l2loopback from the repository



sudo apt install v4l2loopback-dkms
sudo modprobe v4l2loopback


Hard: Compile v4l2loopback



If it's not in the repository for your Ubuntu version you can compile it:



sudo apt-get install build-essential checkinstall
wget https://github.com/umlaeute/v4l2loopback/archive/master.zip
unzip master.zip
cd v4l2loopback-master
make
sudo checkinstall --pkgname=v4l2loopback --pkgversion="$(date +%Y%m%d%H%M)-git" --default
sudo modprobe v4l2loopback


Uninstalling



If you want to remove the package you compiled:



sudo apt-get remove v4l2loopback




Usage examples



Now run ffmpeg. Example for desktop:



ffmpeg -f x11grab -framerate 15 -video_size 1280x720 -i :0.0 -f v4l2 /dev/video0


Example for a video input:



ffmpeg -re -i input.mp4 -map 0:v -f v4l2 /dev/video0


You can view it with ffplay:



ffplay /dev/video0


Note that the actual video number may vary depending if an existing device is already using /dev/video0.






share|improve this answer


























  • where can i specify my video ?

    – dsddd
    Feb 8 '17 at 21:08













  • @dsddd Example updated.

    – llogan
    Feb 8 '17 at 21:13











  • I installed the package, but I'm stuck with an error on both examples, either the x11grab or the the mp4 video give me the same [v4l2 @ 0x55ebc0cfdc40] ioctl(VIDIOC_G_FMT): Invalid argument Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Error initializing output stream 0:0 -- Conversion failed! Is there something else I should do? some dependencies I missed?

    – Sabbin
    Jan 29 at 16:43













  • @Sabbin Please show your command and provide a link to a pastebin of the log.

    – llogan
    Jan 30 at 22:27











  • @llogan following your example above, I have this command ffmpeg -re -i 1.mp4 -map 0:v -f v4l2 /dev/video0 pastebin.com/9eDK0NTN, if I try the command to run for desktop ffmpeg -f x11grab -framerate 15 -video_size 1280x720 -i :1 -f v4l2 /dev/video0 I get this error pastebin.com/xN6uZJR6, also the folder /dev/video0 has rights for write

    – Sabbin
    Feb 4 at 7:37


















6














You can do this with v4l2loopback. First you need to install it:



Install v4l2loopback



Easy: Install v4l2loopback from the repository



sudo apt install v4l2loopback-dkms
sudo modprobe v4l2loopback


Hard: Compile v4l2loopback



If it's not in the repository for your Ubuntu version you can compile it:



sudo apt-get install build-essential checkinstall
wget https://github.com/umlaeute/v4l2loopback/archive/master.zip
unzip master.zip
cd v4l2loopback-master
make
sudo checkinstall --pkgname=v4l2loopback --pkgversion="$(date +%Y%m%d%H%M)-git" --default
sudo modprobe v4l2loopback


Uninstalling



If you want to remove the package you compiled:



sudo apt-get remove v4l2loopback




Usage examples



Now run ffmpeg. Example for desktop:



ffmpeg -f x11grab -framerate 15 -video_size 1280x720 -i :0.0 -f v4l2 /dev/video0


Example for a video input:



ffmpeg -re -i input.mp4 -map 0:v -f v4l2 /dev/video0


You can view it with ffplay:



ffplay /dev/video0


Note that the actual video number may vary depending if an existing device is already using /dev/video0.






share|improve this answer


























  • where can i specify my video ?

    – dsddd
    Feb 8 '17 at 21:08













  • @dsddd Example updated.

    – llogan
    Feb 8 '17 at 21:13











  • I installed the package, but I'm stuck with an error on both examples, either the x11grab or the the mp4 video give me the same [v4l2 @ 0x55ebc0cfdc40] ioctl(VIDIOC_G_FMT): Invalid argument Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Error initializing output stream 0:0 -- Conversion failed! Is there something else I should do? some dependencies I missed?

    – Sabbin
    Jan 29 at 16:43













  • @Sabbin Please show your command and provide a link to a pastebin of the log.

    – llogan
    Jan 30 at 22:27











  • @llogan following your example above, I have this command ffmpeg -re -i 1.mp4 -map 0:v -f v4l2 /dev/video0 pastebin.com/9eDK0NTN, if I try the command to run for desktop ffmpeg -f x11grab -framerate 15 -video_size 1280x720 -i :1 -f v4l2 /dev/video0 I get this error pastebin.com/xN6uZJR6, also the folder /dev/video0 has rights for write

    – Sabbin
    Feb 4 at 7:37
















6












6








6







You can do this with v4l2loopback. First you need to install it:



Install v4l2loopback



Easy: Install v4l2loopback from the repository



sudo apt install v4l2loopback-dkms
sudo modprobe v4l2loopback


Hard: Compile v4l2loopback



If it's not in the repository for your Ubuntu version you can compile it:



sudo apt-get install build-essential checkinstall
wget https://github.com/umlaeute/v4l2loopback/archive/master.zip
unzip master.zip
cd v4l2loopback-master
make
sudo checkinstall --pkgname=v4l2loopback --pkgversion="$(date +%Y%m%d%H%M)-git" --default
sudo modprobe v4l2loopback


Uninstalling



If you want to remove the package you compiled:



sudo apt-get remove v4l2loopback




Usage examples



Now run ffmpeg. Example for desktop:



ffmpeg -f x11grab -framerate 15 -video_size 1280x720 -i :0.0 -f v4l2 /dev/video0


Example for a video input:



ffmpeg -re -i input.mp4 -map 0:v -f v4l2 /dev/video0


You can view it with ffplay:



ffplay /dev/video0


Note that the actual video number may vary depending if an existing device is already using /dev/video0.






share|improve this answer















You can do this with v4l2loopback. First you need to install it:



Install v4l2loopback



Easy: Install v4l2loopback from the repository



sudo apt install v4l2loopback-dkms
sudo modprobe v4l2loopback


Hard: Compile v4l2loopback



If it's not in the repository for your Ubuntu version you can compile it:



sudo apt-get install build-essential checkinstall
wget https://github.com/umlaeute/v4l2loopback/archive/master.zip
unzip master.zip
cd v4l2loopback-master
make
sudo checkinstall --pkgname=v4l2loopback --pkgversion="$(date +%Y%m%d%H%M)-git" --default
sudo modprobe v4l2loopback


Uninstalling



If you want to remove the package you compiled:



sudo apt-get remove v4l2loopback




Usage examples



Now run ffmpeg. Example for desktop:



ffmpeg -f x11grab -framerate 15 -video_size 1280x720 -i :0.0 -f v4l2 /dev/video0


Example for a video input:



ffmpeg -re -i input.mp4 -map 0:v -f v4l2 /dev/video0


You can view it with ffplay:



ffplay /dev/video0


Note that the actual video number may vary depending if an existing device is already using /dev/video0.







share|improve this answer














share|improve this answer



share|improve this answer








edited Feb 4 at 19:08

























answered Feb 8 '17 at 21:05









lloganllogan

5,2401737




5,2401737













  • where can i specify my video ?

    – dsddd
    Feb 8 '17 at 21:08













  • @dsddd Example updated.

    – llogan
    Feb 8 '17 at 21:13











  • I installed the package, but I'm stuck with an error on both examples, either the x11grab or the the mp4 video give me the same [v4l2 @ 0x55ebc0cfdc40] ioctl(VIDIOC_G_FMT): Invalid argument Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Error initializing output stream 0:0 -- Conversion failed! Is there something else I should do? some dependencies I missed?

    – Sabbin
    Jan 29 at 16:43













  • @Sabbin Please show your command and provide a link to a pastebin of the log.

    – llogan
    Jan 30 at 22:27











  • @llogan following your example above, I have this command ffmpeg -re -i 1.mp4 -map 0:v -f v4l2 /dev/video0 pastebin.com/9eDK0NTN, if I try the command to run for desktop ffmpeg -f x11grab -framerate 15 -video_size 1280x720 -i :1 -f v4l2 /dev/video0 I get this error pastebin.com/xN6uZJR6, also the folder /dev/video0 has rights for write

    – Sabbin
    Feb 4 at 7:37





















  • where can i specify my video ?

    – dsddd
    Feb 8 '17 at 21:08













  • @dsddd Example updated.

    – llogan
    Feb 8 '17 at 21:13











  • I installed the package, but I'm stuck with an error on both examples, either the x11grab or the the mp4 video give me the same [v4l2 @ 0x55ebc0cfdc40] ioctl(VIDIOC_G_FMT): Invalid argument Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Error initializing output stream 0:0 -- Conversion failed! Is there something else I should do? some dependencies I missed?

    – Sabbin
    Jan 29 at 16:43













  • @Sabbin Please show your command and provide a link to a pastebin of the log.

    – llogan
    Jan 30 at 22:27











  • @llogan following your example above, I have this command ffmpeg -re -i 1.mp4 -map 0:v -f v4l2 /dev/video0 pastebin.com/9eDK0NTN, if I try the command to run for desktop ffmpeg -f x11grab -framerate 15 -video_size 1280x720 -i :1 -f v4l2 /dev/video0 I get this error pastebin.com/xN6uZJR6, also the folder /dev/video0 has rights for write

    – Sabbin
    Feb 4 at 7:37



















where can i specify my video ?

– dsddd
Feb 8 '17 at 21:08







where can i specify my video ?

– dsddd
Feb 8 '17 at 21:08















@dsddd Example updated.

– llogan
Feb 8 '17 at 21:13





@dsddd Example updated.

– llogan
Feb 8 '17 at 21:13













I installed the package, but I'm stuck with an error on both examples, either the x11grab or the the mp4 video give me the same [v4l2 @ 0x55ebc0cfdc40] ioctl(VIDIOC_G_FMT): Invalid argument Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Error initializing output stream 0:0 -- Conversion failed! Is there something else I should do? some dependencies I missed?

– Sabbin
Jan 29 at 16:43







I installed the package, but I'm stuck with an error on both examples, either the x11grab or the the mp4 video give me the same [v4l2 @ 0x55ebc0cfdc40] ioctl(VIDIOC_G_FMT): Invalid argument Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Error initializing output stream 0:0 -- Conversion failed! Is there something else I should do? some dependencies I missed?

– Sabbin
Jan 29 at 16:43















@Sabbin Please show your command and provide a link to a pastebin of the log.

– llogan
Jan 30 at 22:27





@Sabbin Please show your command and provide a link to a pastebin of the log.

– llogan
Jan 30 at 22:27













@llogan following your example above, I have this command ffmpeg -re -i 1.mp4 -map 0:v -f v4l2 /dev/video0 pastebin.com/9eDK0NTN, if I try the command to run for desktop ffmpeg -f x11grab -framerate 15 -video_size 1280x720 -i :1 -f v4l2 /dev/video0 I get this error pastebin.com/xN6uZJR6, also the folder /dev/video0 has rights for write

– Sabbin
Feb 4 at 7:37







@llogan following your example above, I have this command ffmpeg -re -i 1.mp4 -map 0:v -f v4l2 /dev/video0 pastebin.com/9eDK0NTN, if I try the command to run for desktop ffmpeg -f x11grab -framerate 15 -video_size 1280x720 -i :1 -f v4l2 /dev/video0 I get this error pastebin.com/xN6uZJR6, also the folder /dev/video0 has rights for write

– Sabbin
Feb 4 at 7:37




















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


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




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f881305%2fis-there-any-way-ffmpeg-send-video-to-dev-video0-on-ubuntu%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Human spaceflight

Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

張江高科駅