1

I'd like to use ffmpeg to simulate a network webcam. These usually give out an MJPEG feed that plays in a browser. I want to create a stream like this locally as a test case for a software I plan to write.

This is the input file

Input #1, matroska,webm, from 'webcam.mkv':
  Metadata:
    ENCODER         : Lavf58.29.100
  Duration: 00:27:16.70, start: 0.000000, bitrate: 2664 kb/s
  Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 1k tbn (default)
    Metadata:
      DURATION        : 00:27:16.700000000
  Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp (default)
    Metadata:
      title           : simple_aac
      DURATION        : 00:27:16.565000000

I need a video only MJPEG stream, no audio.

I tried:

ffmpeg -i webcam.mkv -vcodec mjpeg -an http://localhost:8090/monitoring1.ffm

and get

[NULL @ 000001f915d10d80] Unable to find a suitable output format for 'http://localhost:8090/monitoring1.ffm'
http://localhost:8090/monitoring1.ffm: Invalid argument

Any way I can select the output format?

576i
  • 423
  • 3
  • 12
  • 22
  • Can you try `-f mjpeg` or similar before `http....` ? – Rajib Oct 16 '21 at 07:36
  • @Rajib - If I try that, I get `Connection to tcp://localhost:8090 failed: Error number -138 occurred http://localhost:8090/monitoring1.ffm: Unknown error` after a second or two – 576i Oct 16 '21 at 10:07
  • This seems to be a tcp/ip port configuration issue. Perhaps you should add that in your tags and edit your question to reflect the new error. – Rajib Oct 16 '21 at 10:31
  • @Rajib - in this situation, ffmpeg should behave as a server and not connect to anything. A browser would be a client to connect to the localhost address. Anyway, thanks for trying to help. – 576i Oct 16 '21 at 11:51

0 Answers0