Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#4113 closed defect (fixed)

ffserver ignores videoframerate for mjpeg streams

Reported by: ill Owned by:
Priority: normal Component: ffserver
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I have "VideoFrameRate 1" in ffserver.conf, but when watching the stream, it is updated far more than a single frame per second, so it seems that ffserver is silently ignore this option. FFmpeg says it is 5 when launching that, but there is no reason for it to override an output stream like that. I think it is only supposed to be able to override the input refresh if it is wrong.

<Stream test.mjpg>

Feed cam.ffm
Format mpjpeg
VideoFrameRate 1
VideoIntraOnly
VideoQmin 10
VideoQMax 20
VideoSize 480x320
NoAudio
Strict -1

</Stream>

$ ./ffserver -f /etc/ffserver.conf
ffserver version N-67731-gce80f9f Copyright (c) 2000-2014 the FFmpeg developers

built on Nov 15 2014 20:32:58 with gcc 4.8 (SUSE Linux)
configuration: --enable-libfreetype --enable-libfontconfig
libavutil 54. 13.100 / 54. 13.100
libavcodec 56. 12.101 / 56. 12.101
libavformat 56. 13.100 / 56. 13.100
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 2.103 / 5. 2.103
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100

/etc/ffserver.conf:5: Port option is deprecated, use HTTPPort instead
/etc/ffserver.conf:9: BindAddress option is deprecated, use HTTPBindAddress instead
/etc/ffserver.conf:150: 'Title' option in configuration file is deprecated, use 'Metadata title VALUE' instead
Sun Nov 16 18:26:01 2014 FFserver started.

$ ./ffmpeg -f alsa -itsoffset 0.7 -ar 24000 -i plughw:2 -f video4linux2 -inputormat mjpeg -s 960x720 -r 5 -i /dev/video0 -map 0:a -map 1:v http://127.0.0.1:8090/cam.ffm -f segment -segment_time 3600 -segment_atclocktime 1 -r 5 -s 640x480 -reset_timestamps 1 -segment_list_flags live -vf "drawtext='fontfile=/usr/share/fonts/truetype/DejaVuSans.ttf:fontcolor=white:fontsize=30:x=1:y=2:shadowx=1:shadowy=1:text=%{localtime\:%Y-%m-%d %H

\:%M

\:%S}'" -segment_start_number 94 /media/cam/test_%04d.avi
ffmpeg version N-67731-gce80f9f Copyright (c) 2000-2014 the FFmpeg developers

built on Nov 15 2014 20:32:58 with gcc 4.8 (SUSE Linux)
configuration: --enable-libfreetype --enable-libfontconfig
libavutil 54. 13.100 / 54. 13.100
libavcodec 56. 12.101 / 56. 12.101
libavformat 56. 13.100 / 56. 13.100
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 2.103 / 5. 2.103
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100

Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, alsa, from 'plughw:2':

Duration: N/A, start: 1416187590.440149, bitrate: 768 kb/s

Stream #0:0: Audio: pcm_s16le, 24000 Hz, 2 channels, s16, 768 kb/s

Input #1, video4linux2,v4l2, from '/dev/video0':

Duration: N/A, start: 542826.030897, bitrate: N/A

Stream #1:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 960x720, 0 kb/s, 5 fps, 5 tbr, 1000k tbn, 1000k tbc

[swscaler @ 0x2b0f7e0] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x2b7af40] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x2b96cc0] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x2bb73e0] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x2be6ae0] deprecated pixel format used, make sure you did set range correctly
Output #0, ffm, to 'http://127.0.0.1:8090/cam.ffm':

Metadata:

creation_time : now
encoder : Lavf56.13.100
Stream #0:0: Video: flv1 (flv), yuv420p, 960x720, q=5-15, 4000 kb/s, 5 fps, 1000k tbn, 5 tbc
Metadata:

encoder : Lavc56.12.101 flv

Stream #0:1: Video: mjpeg, yuvj422p(pc), 960x720, q=1-5, 200 kb/s, 5 fps, 1000k tbn, 5 tbc
Metadata:

encoder : Lavc56.12.101 mjpeg

Stream #0:2: Video: mjpeg, yuvj422p(pc), 480x320, q=10-20, 200 kb/s, 5 fps, 1000k tbn, 5 tbc
Metadata:

encoder : Lavc56.12.101 mjpeg

Stream #0:3: Video: flv1 (flv), yuv420p, 320x240, q=1-3, 320 kb/s, 5 fps, 1000k tbn, 5 tbc
Metadata:

encoder : Lavc56.12.101 flv

Stream #0:4: Video: msmpeg4v3 (msmpeg4), yuv420p, 352x240, q=2-31, 256 kb/s, 5 fps, 1000k tbn, 5 tbc
Metadata:

encoder : Lavc56.12.101 msmpeg4

Output #1, segment, to '/media/cam/test_%04d.avi':

Metadata:

encoder : Lavf56.13.100
Stream #1:0: Video: mpeg4, yuv420p, 640x480, q=2-31, 200 kb/s, 5 fps, 5 tbn, 5 tbc
Metadata:

encoder : Lavc56.12.101 mpeg4

Stream #1:1: Audio: ac3, 24000 Hz, stereo, fltp, 192 kb/s
Metadata:

encoder : Lavc56.12.101 ac3

Stream mapping:

Stream #1:0 -> #0:0 (mjpeg (native) -> flv1 (flv))
Stream #1:0 -> #0:1 (mjpeg (native) -> mjpeg (native))
Stream #1:0 -> #0:2 (mjpeg (native) -> mjpeg (native))
Stream #1:0 -> #0:3 (mjpeg (native) -> flv1 (flv))
Stream #1:0 -> #0:4 (mjpeg (native) -> msmpeg4v3 (msmpeg4))
Stream #1:0 -> #1:0 (mjpeg (native) -> mpeg4 (native))
Stream #0:0 -> #1:1 (pcm_s16le (native) -> ac3 (native))

Press [q] to stop, ? for help
[mjpeg @ 0x2b637a0] rc buffer underflow

Last message repeated 2 times

frame= 3 fps=0.0 q=2.0 q=33.7 q=3.1 q=2.0 q=2.0 q=2.0 size= 360kB time=00:00:00.76 bitrate=3840.0kbits/s [mjpeg @ 0x2b637a0] rc buffer underflow
[mjpeg @ 0x2b68e40] rc buffer underflow
[mjpeg @ 0x2b637a0] rc buffer underflow
[mjpeg @ 0x2b68e40] rc buffer underflow
[mjpeg @ 0x2b637a0] rc buffer underflow
[mjpeg @ 0x2b68e40] rc buffer underflow

Change History (10)

comment:1 by mastered, 9 years ago

I reproduced it, patchest that seems to fix it is submitted to mailing list.

Last edited 9 years ago by mastered (previous) (diff)

comment:2 by ill, 9 years ago

Did they accept the patch?

in reply to:  1 comment:3 by Reynaldo H. Verdejo Pinochet, 9 years ago

Replying to mastered:

I reproduced it, patchest that seems to fix it is submitted to mailing list.

Can you add a reference to the commit id once pushed and close this bug as fixed
please? Thanks a lot.

comment:4 by mastered, 9 years ago

First commit that should fix it is 3ff39901049f430f82d252eab3f4c0800ef144e5.
I tested now on git head 302ed9c43f2d2a0764a9f9d2a4b2e512d2c9592f and it seems to be fixed.

comment:5 by Carl Eugen Hoyos, 9 years ago

Component: undeterminedffserver

comment:6 by ill, 9 years ago

I tested it and it is still ignoring my 1 fps command and setting it to 5.

<Stream test.mjpg>

Feed cam.ffm
Format mpjpeg
VideoFrameRate 1
VideoIntraOnly
VideoQmin 10
VideoQMax 20
VideoSize 480x320
NoAudio
Strict -1

</Stream>

ffmpeg version N-68199-g5fe026f Copyright (c) 2000-2014 the FFmpeg developers

built on Dec 4 2014 04:31:52 with gcc 4.8 (SUSE Linux)
configuration: --enable-filter=drawtext --enable-libfreetype
libavutil 54. 15.100 / 54. 15.100
libavcodec 56. 13.100 / 56. 13.100
libavformat 56. 15.102 / 56. 15.102
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 2.103 / 5. 2.103
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100

Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, alsa, from 'plughw:2':

Duration: N/A, start: 1417693863.952144, bitrate: 768 kb/s

Stream #0:0: Audio: pcm_s16le, 24000 Hz, 2 channels, s16, 768 kb/s

Input #1, video4linux2,v4l2, from '/dev/video0':

Duration: N/A, start: 2049100.267583, bitrate: N/A

Stream #1:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 960x720, 0 kb/s, 5 fps, 5 tbr, 1000k tbn, 1000k tbc

[swscaler @ 0x2f067e0] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x2f68120] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x2f8f420] deprecated pixel format used, make sure you did set range correctly
Output #0, ffm, to 'http://127.0.0.1:8090/cam.ffm':

Metadata:

creation_time : now
encoder : Lavf56.15.102
Stream #0:0: Video: flv1 (flv), yuv420p, 960x720, q=5-15, 4000 kb/s, 5 fps, 1000k tbn, 5 tbc
Metadata:

encoder : Lavc56.13.100 flv

Stream #0:1: Video: mjpeg, yuvj422p(pc), 960x720, q=1-5, 64 kb/s, 5 fps, 1000k tbn, 2 tbc
Metadata:

encoder : Lavc56.13.100 mjpeg

Stream #0:2: Video: mjpeg, yuvj422p(pc), 480x320, q=10-20, 64 kb/s, 5 fps, 1000k tbn, 1 tbc
Metadata:

encoder : Lavc56.13.100 mjpeg

comment:7 by mastered, 9 years ago

Don't you use -r 5 as ffmpeg param, which overwrites ffserver config? It seems so.

comment:8 by ill, 9 years ago

I thought that was for the input stream only? What is the syntax for setting the input stream vs the output?

comment:9 by mastered, 9 years ago

Resolution: fixed
Status: newclosed

Parameter meaning depends on its position. ffmpeg <param> -i input output applies to input, fmpeg -i input <param> output applies to output. In general consider parameter applies to right-hand stream.

If you found this still bugged then reopen

comment:10 by ill, 9 years ago

When viewing the stream with the -r 5 argument for ffmpeg, it says that it is outputting 5 fps, but in my camera feed it looks like it is actually getting the 2 fps that ffserver is set to on the latest git I started using, so it seems to be ignoring what it is saying it is outputting and using ffservers config instead. I don't care that much about it, as there are other bugs I am encountering, but I thought you might want to know.

Note: See TracTickets for help on using tickets.