1

I have a setup where a local application writes a sequence of JPEG images into a FIFO (Unix named pipe on Linux). On the other end I have ffmpeg picking up the sequence and passing it into an instance of ffserver:

% ffmpeg -i fifo.mjpeg http://127.0.0.1:8090/feed.ffm

The configuration for ffserver looks like this:

HTTPPort 8090
HTTPBindAddress 0.0.0.0
MaxHTTPConnections 20
MaxClients 10
MaxBandwidth 1000

<Feed feed.ffm>
  File /tmp/feed.ffm
  FileMaxSize 200k

  ACL allow 127.0.0.1
</Feed>

<Stream stream.mpjpeg>
  Format mpjpeg
  Feed feed.ffm

  VideoSize 960x600
  VideoFrameRate 2
  VideoIntraOnly
  Strict -1

  NoAudio
  NoDefaults
</Stream>

This works fine, I can point my web browser to http://127.0.0.1:8090/stream.mpjpeg and see the video.

Now I want to add a way to download a single JPEG (I think of it as snapshot of the video). I added the following to the ffserver configuration:

<Stream image.jpg>
  Format singlejpeg
  Feed feed.ffm

  VideoSize 960x600
  VideoFrameRate 2
  VideoIntraOnly
  Strict -1

  NoAudio
  NoDefaults
</Stream>

That only sort of works. Sure, if I point my browser to http://127.0.0.1:8090/image.jpg I do so a still picture from the video, but the browser never stops loading!

Indeed, if I run wget http://127.0.0.1:8090/image.jpg I see that the MIME type is good (image/jpeg), but there seems to be no end to the image.

Am I missing something in my configuration that makes ffserver sending more than a single image?

I should add I've tried this setup on both 2.8.6 (Debian Jessie, package comes from jessie-backports) and 3.0 (Arch Linux), with the same result in both cases.

Magnus
  • 4,644
  • 1
  • 33
  • 49

1 Answers1

0

You know, I am in searching to find out an answer to the question. I found only the way to do this using the mjpg-streamer:

mjpg_streamer -i 'input_uvc.so -f 15 -r 640x480' -o 'output_http.so'

gives you to download the snapshots via http://localhost:8080/?action=snapshot. But I could to do this using the ffmpeg...

EDIT:

It looks like I figured out how to make the "snapshotable" ffserver. Here is my configuration:

HTTPPort 8090
HTTPBindAddress 0.0.0.0
MaxHTTPConnections 20
MaxClients 10
MaxBandwidth 100000

<Feed feed.ffm>
  File /tmp/feed.ffm
  FileMaxSize 200k

  ACL allow 127.0.0.1
</Feed>

<Stream image.jpg>
  Feed feed.ffm
  Format jpeg

  VideoSize 800x600
  VideoFrameRate 30
  Preroll 5
  VideoIntraOnly
  Strict -1

  NoAudio
  NoDefaults
</Stream>

EDIT:

Unfortunately this method gives a strange hangs sometimes...

Serge Roussak
  • 1,731
  • 1
  • 14
  • 28