ffmpeg windows av_interleaved_write_frame(): Operation not permitted failure - windows

I'm trying to share my computer's camera with the remote computer. Local machine is linux(ubuntu 20.04.1) and remote machine is windows 10. I created virtual camera in windows machine with use OBS virtual cam and I want to share camera from local to remote machine. I could start stream from local linux machine and I got stream via windows machine. But when I try to write the stream into the virtual camera(output device), I get the error av_interleaved_write_frame (): Operation not permitted.
The command I wrote on the Windows side is as follows:
ffmpeg.exe -f mpegts -i udp://192.168.5.5:5010 -c:v rawvideo -r 30 -pix_fmt yuyv422 -s 1280x720 -f sdl "OBS-Camera"
The error message is as follows:
Extra Info1: In my experiments, if both the local and remote machines are Linux, it works successfully.
Extra Info2: I can view the stream that I received on windows side(remote) with the command ffplay.exe udp: //192.168.5.5: 5010.
Do you have any suggestion ?

Related

Access webcam of sleeping Mac in ssh with FFmpeg

I am able from my Macbook to ssh my remote Macmini which is ON (logged in and not sleeping) and use my webcam with a command like ffmpeg -f avfoundation -framerate 30 -i "0:0" out.avi however, when the remote Macmini is logged out (or/and sleeping) ffmpeg gives me an error that it cannot use the webcam Failed to create AV capture input device: Cannot use PC-LM1E. Any workaround? I want to check on my pets while out of my house and would like to keep the Macmini at sleep.
Thanks I advance.

Streaming FFmpeg over TCP

I'm experimenting with streaming video using the following basic method, which works fine:
$ ffmpeg -re -i INPUT -f mpegts udp://127.0.0.1:2000
$ ffplay udp://127.0.0.1:2000
However, when replacing udp with tcp (see here), ffmpeg says "connection refused".
[tcp # 0x7f9ddb408880] Connection to tcp://127.0.0.1:2000 failed: Connection refused
tcp://127.0.0.1:2000: Connection refused
How do I fix this?
(All articles I find on the "connection refused" topic relate to FFserver, which is discontinued.)
Using macOS + FFmpeg 4.0.3
Did you specify the "listen" option on one side?
i.e. ffmpeg -re -i INPUT -f mpegts tcp://127.0.0.1:2000\?listen
Connection to tcp://127.0.0.1:2000 failed: Connection refused
This could also appear when there is a process/program already running at that port (in your case, port 2000) and you try to run another program on it or run the same program once more.
You can use,
netstat -tupln
to see if any program is running on that port.
If you want to run any program while a program is already running on that port, you can kill the existing program using,
kill -9 $(lsof -i:<port_number>)
In your case,
kill -9 $(lsof -i:2000)
After killing the program on the port you can try ffmpeg command again.

ffmpeg to nginx rtmp on windows got I/O error

using https://github.com/illuspas/nginx-rtmp-win32
windows server 2018
no touch to conf, just illuspas original, run nginx.exe as admin
firewall disabled
no antivirus
service started as a charm, no error in nginx log
run following cmdline as admin
ffmpeg -re -i "rtsp://111.10.31.131:554/pag://192.168
.1.5:7302:001110:0:MAIN:TCP?cnid=2&pnid=1" -f flv -s 640x480 "rtmp://localhost:1
935/live/abc" -loglevel debug
i got this:
see this pic: https://i.stack.imgur.com/3RpNY.jpg
I want to put the rtsp source to a rtmp channel, why im getting this rtsp://***** I/O error? what does that mean? any idea that i could get this rtmp stream?
any input would be appreciated!
I had the same problem. I had to give my rtmp sink rights to write at the location (i somehow lost it)

Recording pulse audio as CAP_SYS_ADMIN with ffmpeg

As my normal user, this works:
ffmpeg -f pulse -i default -acodec aac foo.aac
but run with sudo is fails with:
default: No such process
How can I run ffmpeg as a privileged user (CAP_SYS_ADMIN), since I am keen to use the kmsgrab option and still get access to sound in order to record it too?
There are two steps to connecting to the Pulse Audio server:
Server path. By default, the PulseAudio server makes itself accessible to clients by creating a UNIX socket under $XDG_RUNTIME_DIR. Running commands via sudo will reset the environment, thus making PulseAudio clients unable to find the server to connect to.
Authentication. By default, the PulseAudio server creates an authentication cookie in ~/.pulse-cookie, which clients must relay to the server upon connecting. If $HOME or $PULSE_COOKIE are not set to the cookie's location, clients will be unable to authenticate.
The complete command of thus running ffmpeg via sudo is as follows:
sudo env \
PULSE_COOKIE=$HOME/.pulse-cookie \
PULSE_SERVER=$XDG_RUNTIME_DIR/pulse/native \
ffmpeg -y -f pulse -i default -acodec aac foo.aac
You can probably substitute PULSE_SERVER with the -server ffmpeg device option.

Scripting VLC to capture first frame of a video - can't get command line to work

I'm creating a script to pull a video off the web, create an image of the first frame, and save the image as a file. My script is handling grabbing a lot of videos and giving the file names a sequential number.
My problem is in using VLC to grab the video and actually save the file. Experimenting with the command-line and just a local file before I put it into my script, I've tried:
vlc -vvv -I dummy --video-filter=scene --start-time=1 --stop-time=1 --scene-format=jpeg --scene-ratio=24 --scene-prefix=EXEC samp.mp4 vlc://quit
-> uncaught exception
vlc -vvv -I dummy --no-audio --video-filter=scene --start-time=1 --stop-time=1 --scene-format=jpeg --scene-ratio=24 --scene-prefix=EXEC samp.mp4 vlc://quit
-> uncaught exception
vlc -vvv -I rc --video-filter=scene --start-time=1 --stop-time=1 --scene-format=jpeg --scene-ratio=24 --scene-prefix=EXEC samp.mp4 vlc://quit
-> uncaught exception; looks like I can't do without a -V option
vlc -vvv -I rc -V snapshot --video-filter=scene --start-time=1 --stop-time=1 --scene-format=jpeg --scene-ratio=24 --scene-prefix=EXEC samp.mp4 vlc://quit
-> no vout display module matched "snapshot"; similarly for attempts with module "image", "scene", "opengl"
I'm running VLC 2.0.1 on Mac OS X 10.7.3. Has anybody got VLC to work on the command line (so it's scriptable) to do image capture from videos?
BTW, I've done extensive googling on this - the VLC documentation is hopelessly out of date and most suggestions on the web don't actually work with the latest version of VLC.
Another approach is to use ffmpeg - this worked for me:
ffmpeg -i http://example.com/directory/video.mp4 -ss 0 -vframes 1 -vcodec mjpeg -f image2 keyframe001.jpg
If the result is important, but not the video player, you can do this with mplayer:
mplayer -vo png,outdir=/tmp,prefix=frameNo,z=0 -ao null -frames 1 VIDEO-FILENAME
The VIDEO-FILENAME can be a local file, or an HTTP URL.
To get the command-line mplayer on OSX, just install the graphical one then find the command-line binary in one of these locations:
/Applications/MPlayer OSX.app/Contents/Resources/External_Binaries/mplayer_intel.app/Contents/MacOS/mplayer
or
/Applications/MPlayer OS X 2.app/Contents/Resources/mplayer.app/Contents/MacOS/mplayer
In Windows : vlc C:\test.mp4 --rate=1 --video-filter=scene --vout=dummy --aout=dummy --start-time=10 --stop-time=11 --scene-replace --scene-format=jpg --scene-ratio=29.970029 --scene-prefix=snaphot --scene-path=C:\Users\Gi\Desktop\ vlc://quit
It is worked.

Resources