Opened 11 years ago
Closed 8 years ago
#3142 closed defect (needs_more_info)
FFserver ignores encoding params in stream context
Reported by: | Igor | Owned by: | |
---|---|---|---|
Priority: | important | Component: | ffserver |
Version: | unspecified | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | yes |
Description
This bug occurs after http://trac.ffmpeg.org/ticket/1970 bug "fix" :)
I have tested fixed version d1e8d4b055bd9a79baa15ca80d9a1476d2a8ccdb and noticed that ffserver ignores encoding params in stream context(like: AVOptionVideo , AVOptionAudio , StartSendOnKey, PreRoll)
Here is my simple ffserver.conf
Port 9898
BindAddress? 0.0.0.0
<Feed stream.ffm>
Launch ffmpeg -i udp://239.3.3.3:6666 -override_ffserver -vf yadif -codec:v libx264 -c:a libfaac -bsf:a aac_adtstoasc
File /tmp/t.ffm
FileMaxSize? 2M
</Feed>
<Stream live.flv>
Feed stream.ffm
Preroll 2
StartSendOnKey?
AVOptionVideo flags +global_header
AVOptionAudio flags +global_header
</Stream>
In ffserver.conf in section <stream live.flv> I always used
Preroll
StartSendOnKey?
AVOptionVideo flags +global_header
AVOptionAudio flags +global_header
they all are ignored, I'm getting errors:
" Mon Aug 5 10:01:44 2013 Codec for stream 0 does not use global headers but container format requires global headers
Mon Aug 5 10:01:44 2013 Codec for stream 1 does not use global headers but container format requires global headers
"
Preroll/StartSendOnKey? doesnt work - audio starts immediately, but video appears after 5-15 seconds!
I hope it will not take another 8 months to fix it :)
Change History (15)
comment:1 by , 11 years ago
Component: | undetermined → FFserver |
---|
comment:2 by , 11 years ago
Analyzed by developer: | set |
---|---|
Reproduced by developer: | set |
Status: | new → open |
follow-up: 4 comment:3 by , 11 years ago
In http://ffmpeg.org/ffserver.html#toc-Description I see, that "ffserver is a streaming server for both audio and video. It supports several live feeds, streaming from files and time shifting on live feeds (you can seek to positions in the past on each live feed, provided you specify a big enough feed storage in ‘ffserver.conf’)."
So ffserver is streaming server not encoder, so why to ignore servers params? In this case, params related to streaming server(ffserver) should NOT be ignored. Maybe you have an answer: How to set Preroll, StartSendOnKey in -override_ffserver ? I cant find any option.
If you change just documentation - it doesnt help to solve HUGE BUG. To me, with or without "-override_ffserver" ffserver is just tool in sandbox, because in both situations ffserver has bug's(this and http://trac.ffmpeg.org/ticket/1970).
Thank you
comment:4 by , 11 years ago
Replying to importinis:
In http://ffmpeg.org/ffserver.html#toc-Description I see, that "ffserver is a streaming server for both audio and video. It supports several live feeds, streaming from files and time shifting on live feeds (you can seek to positions in the past on each live feed, provided you specify a big enough feed storage in ‘ffserver.conf’)."
So ffserver is streaming server not encoder, so why to ignore servers params? In this case, params related to streaming server(ffserver) should NOT be ignored. Maybe you have an answer: How to set Preroll, StartSendOnKey in -override_ffserver ? I cant find any option.
AFAIK Preroll
and StartSendOnKey
should be settable even with -override_ffserver
.
-override_ffserver
only affects encoding parameters (which are usually set by ffserver when sending the header to ffmpeg). So for example AVOptionAudio/Video options will be ignored by ffmpeg when you set the option, and you will need to specify the corresponding option in ffmpeg.
Now, simple question since I started to look at ffserver yesterday, how can I reproduce the Preroll/StartSendOnKey issue? What should I expect, what happens instead?
comment:5 by , 11 years ago
take a look in http://trac.ffmpeg.org/ticket/1970 Preroll/StartSendOnKey, there was Preroll/StartSendOnKey defined issues.
What to expect? Strange question, but according to documentation:
# Set this to the number of seconds backwards in time to start. Note that
# most players will buffer 5-10 seconds of video, and also you need to allow
# for a keyframe to appear in the data stream.
#Preroll 15
StartSendOnKey - I dind find any documentation, but it should start playing video&audio simultaniously.
follow-up: 7 comment:6 by , 11 years ago
Could you also provide an example how to provide Preroll and StartSendOnKey to ffmpeg via override_ffserver? I get as expected: "Unrecognized option 'Preroll'."
ffmpeg version N-58502-g738ebb4
to get all ffmpeg options:
# ffmpeg --help full 2>1 | grep -i roll
scroll <int> ..FV.. scroll pattern downward (from 0 to 1)
comment:7 by , 11 years ago
Replying to importinis:
Could you also provide an example how to provide Preroll and StartSendOnKey to ffmpeg via override_ffserver? I get as expected: "Unrecognized option 'Preroll'."
As I told: only encoding options are overriden by ffmpeg. You should be able to set the !Preroll and StartSendOnKey options in the ffserver configuration file, in the corresponding Stream sections.
follow-up: 9 comment:8 by , 11 years ago
As you told me: "AFAIK Preroll and StartSendOnKey should be settable even with -override_ffserver.", now you say that not :)
If you look closely to my previous configs - Preroll and StartSendOnKey params were set in Stream context, BUT they are IGNORED when in Feed context I use override_ffserver in ffmpeg command (Launch ffmpeg -i udp://239.3.3.3:6666 -override_ffserver -vf yadif)!
If I dont use override_ffserver param(all encoding params are set in Stream context) in ffmpeg command, then Preroll and StartSendOnKey works great!
I hope you will fix that bug and Preroll and StartSendOnKey works despite of "-override_ffserver" param is set or not in ffmpeg command.
I hope it's clear now?
comment:9 by , 11 years ago
Replying to importinis:
As you told me: "AFAIK Preroll and StartSendOnKey should be settable even with -override_ffserver.", now you say that not :)
No, read my previous reply better.
If you look closely to my previous configs - Preroll and StartSendOnKey params were set in Stream context, BUT they are IGNORED when in Feed context I use override_ffserver in ffmpeg command (Launch ffmpeg -i udp://239.3.3.3:6666 -override_ffserver -vf yadif)!
If I dont use override_ffserver param(all encoding params are set in Stream context) in ffmpeg command, then Preroll and StartSendOnKey works great!
Now the problem is, how to reproduce the issue?
Let's start with StartSendOnKey, which might be easier to test.
This is my ffserver configuration file:
Port 8090 BindAddress 0.0.0.0 MaxClients 100 MaxBandwidth 60000 CustomLog - <Feed test> File test.ffm Truncate FileMaxSize 10M ACL allow localhost </Feed> <Stream test1> Feed test Format flv StartSendOnKey NoAudio </Stream>
Then I run the command:
ffmpeg -re -override_ffserver -f lavfi -i testsrc -flags:v +global_header -c:v flv -f ffm http://127.0.0.1:8090/test
Now I read the test stream with ffprobe:
ffprobe http://localhost:8090/test1 -show_entries packet=codec_type,flags,pts -of compact -read_intervals "%+#10" -select_streams v ffprobe version N-58295-gbb7f3dd Copyright (c) 2007-2013 the FFmpeg developers [...] Input #0, flv, from 'http://localhost:8090/test1': Metadata: encoder : Lavf55.21.102 Duration: 00:00:00.00, start: 0.000000, bitrate: N/A Stream #0:0: Video: flv1, yuv420p, 320x240, 200 kb/s, 25 tbr, 1k tbn, 1k tbc packet|codec_type=video|pts=0|flags=K packet|codec_type=video|pts=40|flags=_ packet|codec_type=video|pts=80|flags=_ packet|codec_type=video|pts=120|flags=_ packet|codec_type=video|pts=160|flags=_ packet|codec_type=video|pts=200|flags=_ packet|codec_type=video|pts=240|flags=_ packet|codec_type=video|pts=280|flags=_ packet|codec_type=video|pts=320|flags=_ packet|codec_type=video|pts=360|flags=_
If I repeat the test with ffprobe, I always get the same result. If I comment the SendOnKey option in the ffserver file, then it happens that the first packet is not a key-frame.
Can you provide a reproducible test-case which fails?
comment:10 by , 11 years ago
Reproduced by developer: | unset |
---|---|
Resolution: | → needs_more_info |
Status: | open → closed |
Please reopen the ticket if you are able to provide evidence of the issue you reported.
comment:11 by , 11 years ago
Sorry for delay, please notice, that our ffmpeg versions different.
ffserver.conf config:
Port 5000
BindAddress 0.0.0.0
MaxHTTPConnections 100
MaxClients 100
MaxBandwidth 100000
<Feed stream.ffm>
File file.ffm
FileMaxSize 10M
</Feed>
<Stream stream.flv>
Feed stream.ffm
Format flv
StartSendOnKey
</Stream>
I run:
ffmpeg -override_ffserver -i udp://233.239.0.3:1234 -flags:v +global_header -flags:a +global_header -c:v libx264 -b:v 1024k -s 640x480 -r 25 -c:a libfaac -ac 2 -ar 44100 -b:a 128k -f ffm http://localhost:5000/stream.ffm
Then I run ffprobe:
ffprobe http://localhost:5000/stream.flv -show_entries packet=codec_type,flags,pts -of compact -read_intervals "%+#10" -select_streams v
ffprobe version N-58502-g738ebb4 Copyright (c) 2007-2013 the FFmpeg developers
built on Dec 12 2013 10:24:32 with gcc 4.4.5 (Debian 4.4.5-8)
configuration: --prefix=/usr/ffmpeg --enable-nonfree --enable-gpl --enable-runtime-cpudetect --disable-devices --enable-libmp3lame --enable-libfaac --enable-libx264 --disable-protocols --enable-protocol=http --enable-protocol=udp --enable-protocol=file --enable-protocol=pipe --enable-protocol=hls
libavutil 52. 55.100 / 52. 55.100
libavcodec 55. 44.100 / 55. 44.100
libavformat 55. 21.102 / 55. 21.102
libavdevice 55. 5.102 / 55. 5.102
libavfilter 3. 91.100 / 3. 91.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
Input #0, flv, from 'http://localhost:5000/stream.flv':
Metadata:
author :
comment :
copyright :
title :
encoder : Lavf55.21.102
Duration: 00:00:00.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 1024 kb/s, 25 tbr, 1k tbn, 50 tbc
Stream #0:1: Audio: aac, 44100 Hz, stereo, fltp, 128 kb/s
packet|codec_type=video|pts=64|flags=K
packet|codec_type=video|pts=184|flags=K
packet|codec_type=video|pts=144|flags=K
packet|codec_type=video|pts=264|flags=K
packet|codec_type=video|pts=224|flags=K
packet|codec_type=video|pts=344|flags=K
packet|codec_type=video|pts=304|flags=K
packet|codec_type=video|pts=424|flags=K
packet|codec_type=video|pts=384|flags=K
packet|codec_type=video|pts=504|flags=K
If I try to watch with vlc or web flash player - I get audio immediately, but clear video after 5-7sek. With older versions (for example: N-51689-g93e8fcb) no such problem.
Thank you
comment:12 by , 11 years ago
Resolution: | needs_more_info |
---|---|
Status: | closed → reopened |
comment:13 by , 11 years ago
ffprobe from older ffserver(N-51689-g93e8fcb):
ffprobe version N-58502-g738ebb4 Copyright (c) 2007-2013 the FFmpeg developers
built on Dec 12 2013 10:24:32 with gcc 4.4.5 (Debian 4.4.5-8)
configuration: --prefix=/usr/ffmpeg --enable-nonfree --enable-gpl --enable-runtime-cpudetect --disable-devices --enable-libmp3lame --enable-libfaac --enable-libx264 --disable-protocols --enable-protocol=http --enable-protocol=udp --enable-protocol=file --enable-protocol=pipe --enable-protocol=hls
libavutil 52. 55.100 / 52. 55.100
libavcodec 55. 44.100 / 55. 44.100
libavformat 55. 21.102 / 55. 21.102
libavdevice 55. 5.102 / 55. 5.102
libavfilter 3. 91.100 / 3. 91.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
Input #0, flv, from 'http://localhost:5001/stream.flv':
Metadata:
author :
comment :
copyright :
title :
encoder : Lavf55.1.100
Duration: 00:00:00.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 1024 kb/s, 25 tbr, 1k tbn, 50 tbc
Stream #0:1: Audio: aac, 44100 Hz, stereo, fltp, 128 kb/s
packet|codec_type=video|pts=0|flags=K
packet|codec_type=video|pts=40|flags=_
packet|codec_type=video|pts=80|flags=_
packet|codec_type=video|pts=120|flags=_
packet|codec_type=video|pts=160|flags=_
packet|codec_type=video|pts=200|flags=_
packet|codec_type=video|pts=240|flags=_
packet|codec_type=video|pts=280|flags=_
packet|codec_type=video|pts=320|flags=_
packet|codec_type=video|pts=360|flags=_
comment:14 by , 8 years ago
You have mismatching codecs, ffserver expects a flv1 stream but you feed it a h264 stream with -override_ffserver, can you reproduce this without mismatches ?
comment:15 by , 8 years ago
Resolution: | → needs_more_info |
---|---|
Status: | reopened → closed |
closing due to lack of reply and the case looked at has a codec mismatch
This is the expected behavior, after the -override_ffserver option is specified. It should be probably documented better, and/or a warning should be issued.