On 25/01/2021 15:26, The Natural Philosopher wrote:
> On 25/01/2021 15:20, The Natural Philosopher wrote:
>> On 25/01/2021 15:05, Mike Scott wrote:
>>> Hi all. I'm trying to get ffmpeg to read from an IP camera. Command
>>> line presumably something like
>>>
>>> ffmpeg -f mjpeg -i
http://camera1.XXXXX -pix_fmt yuv420p -f v4l2
>>> /dev/video10
>>>
>>> However, the camera has a login page before allowing access from a
>>> browser, and I can't figure out how to get ffmpeg to provide the
>>> necessary auth info. I've tried various disparate ideas from the web
>>> without success.
>>>
>>> There's an 'authorization: basic yadayada' html header when used from
>>> a browser. But ffmpeg?
>>>
>>
>> you want to use something like wget....| ffmpeg... or curl
>>
>> those take auth.
>>
>>
>
> curl --user "USERNAME:PASSWORD"
http://camera1.XXXXX | ffmpeg blathere...
Finally sorted.
The 'curl' was key - thanks - but I also needed a different url. Turns
out there's snapshot.cgi and a videostream.cgi. I got the former from
wireshark, and the latter by googling the former, which turned up a
useful page about foscam cameras.
So I ended up with
curl --user 'user:pwd'
http://camera1/videostream.cgi | ffmpeg -f mjpeg
-i - -pix_fmt yuv420p -f v4l2 /dev/video10
Which feeds happily into OBS (although not cheese, which ignores the
loopback device).
Incidently, the camera's root account was not what you'd call exactly
secure. I had a pretty good root around, but couldn't find the cgi
scripts; lots of html and js, but no cgi. Odd.
Thanks all for help offered.