Package: ffmpeg Version: 3.6.2 When i try to show an image from a ffserver single jpeg output stream the client browser keep downloading it forever. That's because ffserver doesn't support a single jpeg stream and treat it as a multipart jpeg sequence.
So i've made the follow path to correct the problem. I've corrected the mime-type to image/jpeg as well. The idea is just to close the connection after a jpeg frame has been sent to client. tanks, Otávio Ribeiro
--- ffmpeg-0.cvs20060329/ffserver.c 2006-03-29 14:53:49.000000000 -0300 +++ ffmpeg-0.cvs20060329.my/ffserver.c 2006-06-22 01:29:51.055073888 -0300 @@ -212,6 +213,8 @@ int multicast_ttl; int loop; /* if true, send the stream in loops (only meaningful if file) */ + char single_frame; /*only a single frame must be send*/ + /* feed specific */ int feed_opened; /* true if someone is writing to the feed */ int is_feed; /* true if it is a feed */ @@ -863,6 +866,10 @@ } if (http_send_data(c) < 0) return -1; + + if(c->stream->single_frame && c->data_count > c->cur_frame_bytes && c->cur_frame_bytes > 0) + return -1; + break; case HTTPSTATE_RECEIVE_DATA: /* no need to read if no events */ @@ -3979,7 +3986,7 @@ stream->stream_type = STREAM_TYPE_LIVE; /* jpeg cannot be used here, so use single frame jpeg */ if (!strcmp(arg, "jpeg")) - strcpy(arg, "mjpeg"); + stream->single_frame=1; stream->fmt = guess_stream_format(arg, NULL, NULL); if (!stream->fmt) { fprintf(stderr, "%s:%d: Unknown Format: %s\n",
--- ffmpeg-0.cvs20060329/libavformat/raw.c 2006-03-29 14:53:57.000000000 -0300 +++ ffmpeg-0.cvs20060329.my/libavformat/raw.c 2006-06-22 01:28:51.333153000 -0300 @@ -592,6 +592,19 @@ }; #ifdef CONFIG_MUXERS +AVOutputFormat jpeg_oformat = { + "jpeg", + "JPEG single image", + "image/jpeg", + "jpg,jpeg", + 0, + 0, + CODEC_ID_MJPEG, + raw_write_header, + raw_write_packet, + raw_write_trailer, +}; + AVOutputFormat mjpeg_oformat = { "mjpeg", "MJPEG video", @@ -791,6 +804,7 @@ av_register_input_format(&mjpeg_iformat); av_register_output_format(&mjpeg_oformat); + av_register_output_format(&jpeg_oformat); av_register_input_format(&ingenient_iformat);