#122 FFserver locks up on single jpg

open
nobody
None
5
2003-09-06
2003-09-06
Anonymous
No

I have a security cam system that is useing ffserver to provide
windows media and single jpg captures to a webpage.

the single jpg files are being grabed by a wget
http://locahost:<port>/test.jpg
this is being done by a crontab script that then saves and renames
the jpg with a date/time stamp.

What I have been able to track down is ffserver does not send the
jpg (wget waits AND waits) and eventually locks up the live stream
(WMP says buffering and stays there...)

shortpier@shortpier.is-a-geek.com

box is an amd xp2000+, bttv card, 128 megs ram (I know it s low
but...) its 4.6 version of ffmepeg and server

Thanks

Discussion

  • xx

    xx - 2006-06-20

    Logged In: YES
    user_id=990528

    In my solution a new flag has been
    created at FFStream structure to indicate that this is a
    single frame
    stream. With this is possible to close the connection after
    a frame
    transmission. I've also corrected the mime-type at libavformat

    Follow the patch:

    *** ./ffmpeg/ffserver.c 2006-06-18 10:44:19.297702512 -0300
    --- ./ffmpeg_novo/ffserver.c 2006-06-18
    10:48:30.583501264 -0300
    *************** typedef struct FFStream {
    *** 211,216 ****
    --- 211,218 ----
    int multicast_port; /* first port used for multicast */
    int multicast_ttl;
    int loop; /* if true, send the stream in loops (only
    meaningful if
    file) */
    +
    + char single_frame; /* only single frame */

    /* feed specific */
    int feed_opened; /* true if someone is writing to
    the feed */
    *************** static int handle_connection(HTTPContext
    *** 863,868 ****
    --- 865,875 ----
    }
    if (http_send_data(c) < 0)
    return -1;
    +
    + //Check if it is a single jpeg frame 123
    + if(c->stream->single_frame && c->data_count >
    c->cur_frame_bytes && c->cur_frame_bytes > 0){
    + close_connection(c);
    + }
    break;
    case HTTPSTATE_RECEIVE_DATA:
    /* no need to read if no events */
    *************** static int parse_ffconfig(const char *fi
    *** 3979,3985 ****
    --- 3986,3992 ----
    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/libavformat/raw.c 2006-06-18
    10:44:19.241711024 -0300
    --- ./ffmpeg_novo/libavformat/raw.c 2006-06-17
    19:30:57.000000000
    -0300
    *************** AVInputFormat ingenient_iformat = {
    *** 648,653 ****
    --- 648,666 ----
    };

    #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",
    *************** int raw_init(void)
    *** 854,859 ****
    --- 867,873 ----

    av_register_input_format(&mjpeg_iformat);
    av_register_output_format(&mjpeg_oformat);
    + av_register_output_format(&jpeg_oformat);

    av_register_input_format(&ingenient_iformat);

     
  • Michael Niedermayer

    Logged In: YES
    user_id=282150
    Originator: NO

    patches _must_ be sent to the ffmpeg-dev mailinglist, they also MUST be unified diffs and they must be attached in a way which does not mangle them, the patch here is useless i cant even forward it to ffmpeg-dev

     

Log in to post a comment.