[FFmpeg-user] need an example unix domain sockets usage

Moritz Barsnick barsnick at gmx.net
Fri May 12 22:37:27 EEST 2017


On Fri, May 12, 2017 at 19:41:10 +0530, Ratheendran R wrote:
> *I am trying to ffmpeg and ffplay commands on ubuntu as below.the ffplay
> <command > gives a permission denied. ffmpeg exits immediatly *
> 
> >>>>* ./ffplay -f mpegts unix:///tmp/ff.socket&
> *>>>>* sleep 2&&  ./ffmpeg_g -re -i something -vcodec copy -acodec copy -f
> *>>
> * mpegts unix://tmp/ff.socket
> *
> 
> *I am not able to make any progress for some time,please let me know
> if I am missing anything.*

First of all, your paths to the socket are different:
unix:///tmp/ff.socket
unix://tmp/ff.socket

Secondly, unlike what the ffmpeg documentation says, it looks like you
need to add *no* extra slashes, so the correct URI is
unix:/tmp/ff.socket
(It shouldn't matter in this case, the OS ignores the extra slashes.)

Thirdly, with your commands, both commands should give "no such
file or directory", because ffmpeg needs to feed (and create) the
socket first, before ffplay can access it.

Fourthly, to create a socket, you need to add the "-listen 1" option
to the ffmpeg command line.

Fifthly, if you launch ffmpeg first and try to put it to the
background, you need to disable its interaction with the terminal, by
adding "-nostdin" (otherwise, it stalls in my attempts).

I succeeded with this:

$ ffmpeg -nostdin -f lavfi -i testsrc -f mpegts -listen 1 unix:/tmp/ffmpeg.socket & ffplay unix:/tmp/ffmpeg.socket

(ffplay doesn't need "-f mpegts" in this scenario.)

Moritz


More information about the ffmpeg-user mailing list