Opened 10 years ago

Closed 6 years ago

#3265 closed defect (invalid)

Trouble with WebM and FFserver

Reported by: pferland Owned by:
Priority: normal Component: ffserver
Version: git-master Keywords: regression, ffserver, ffm
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

I cannot get webM to work with FFserver git-master, it will only work with FFserver v1.0.8. In 1.0.8 if i add a x264 stream to the same feed as the webm stream, the feed will no longer keep the ffmpeg input going. and get the same error below.

Command:
/home/pferland/bin/ffmpeg -v 9 -loglevel 99 -i /mnt/e/Shows/Bobs\ Burgers/Season\ 02/bobs.burgers.207.hdtv-lol.avi -ss 00:00:00 http://172.16.0.57:8090/feed1.ffm

Error:
av_interleaved_write_frame(): Connection reset by peer

ffserver.conf:

Port 8090
BindAddress 172.16.0.57
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 10000
CustomLog /var/log/ffserver/access.log

<Feed feed1.ffm>
File /tmp/feed1.ffm
FileMaxSize 6GB
</Feed>

<Stream stream1.webm>

Feed feed1.ffm
Format webm

AudioCodec vorbis
AudioBitRate 64
AudioChannels 2
AudioSampleRate 44100

VideoCodec libvpx
VideoSize hd720
VideoFrameRate 25
VideoBitRate 400
VideoQMin 10
VideoQMax 31
VideoGopSize 12

AVOptionVideo flags +global_header
AVOptionAudio flags +global_header
PreRoll 15
StartSendOnKey

</Stream>

FFmpeg full verbose output:

ffmpeg version N-59486-g2e59ffb Copyright (c) 2000-2014 the FFmpeg developers

built on Jan 2 2014 17:54:30 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration: --prefix=/home/pferland/ffmpeg_build --extra-cflags=-I/home/pferland/ffmpeg_build/include --extra-ldflags=-L/home/pferland/ffmpeg_build/lib --bindir=/home/pferland/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree
libavutil 52. 59.100 / 52. 59.100
libavcodec 55. 47.100 / 55. 47.100
libavformat 55. 22.102 / 55. 22.102
libavdevice 55. 5.102 / 55. 5.102
libavfilter 4. 0.103 / 4. 0.103
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100

Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-i' ... matched as input file with argument '/mnt/e/Shows/Bobs Burgers/Season 02/bobs.burgers.207.hdtv-lol.avi'.
Reading option '-ss' ... matched as option 'ss' (set the start time offset) with argument '00:00:00'.
Reading option 'http://172.16.0.57:8090/feed1.ffm' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input file /mnt/e/Shows/Bobs Burgers/Season 02/bobs.burgers.207.hdtv-lol.avi.
Successfully parsed a group of options.
Opening an input file: /mnt/e/Shows/Bobs Burgers/Season 02/bobs.burgers.207.hdtv-lol.avi.
[avi @ 0x218b940] Format avi probed with size=2048 and score=100
[avi @ 0x218bfe0] use odml:1
[avi @ 0x218b940] Before avformat_find_stream_info() pos: 9912 bytes read:1477376 seeks:4
[h264 @ 0x218c420] no picture
[avi @ 0x218b940] All info found
rfps: 23.750000 0.011842

Last message repeated 1 times

rfps: 23.833333 0.004720

Last message repeated 1 times

rfps: 23.916667 0.000817

Last message repeated 1 times

rfps: 24.000000 0.000133

Last message repeated 1 times

rfps: 24.083333 0.002669

Last message repeated 1 times

rfps: 24.166667 0.008425

Last message repeated 1 times

rfps: 24.250000 0.017400

Last message repeated 1 times

rfps: 47.666667 0.018878

Last message repeated 1 times

rfps: 47.750000 0.009463

Last message repeated 1 times

rfps: 47.833333 0.003267

Last message repeated 1 times

rfps: 47.916667 0.000290

Last message repeated 1 times

rfps: 48.000000 0.000533

Last message repeated 1 times

rfps: 48.083333 0.003995

Last message repeated 1 times

rfps: 48.166667 0.010677

Last message repeated 1 times

rfps: 23.976024 0.000000
rfps: 47.952048 0.000000
[avi @ 0x218b940] After avformat_find_stream_info() pos: 93954 bytes read:1542912 seeks:4 frames:108
Input #0, avi, from '/mnt/e/Shows/Bobs Burgers/Season 02/bobs.burgers.207.hdtv-lol.avi':

Metadata:

encoder : Lavf54.29.104

Duration: 00:21:21.86, start: 0.000000, bitrate: 465 kb/s

Stream #0:0, 41, 1001/24000: Video: h264 (High) (H264 / 0x34363248), yuv420p, 720x404, 1001/48000, 23.98 fps, 23.98 tbr, 23.98 tbn, 47.95 tbc
Stream #0:1, 67, 3/125: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 128 kb/s

Successfully opened the file.
Parsing a group of options: output file http://172.16.0.57:8090/feed1.ffm.
Applying option ss (set the start time offset) with argument 00:00:00.
Successfully parsed a group of options.
Opening an output file: http://172.16.0.57:8090/feed1.ffm.
[http @ 0x218f600] request: GET /feed1.ffm HTTP/1.1
User-Agent: Lavf/55.22.102
Accept: */*
Range: bytes=0-
Connection: close
Host: 172.16.0.57:8090

[http @ 0x218f600] header='HTTP/1.0 200 OK'
[http @ 0x218f600] http_code=200
[http @ 0x218f600] header='Pragma: no-cache'
[http @ 0x218f600] header='Content-Type: application/x-octet-stream'
[http @ 0x218f600] header=
[ffm @ 0x224bea0] Format ffm probed with size=2048 and score=101
[AVIOContext @ 0x221dc40] Statistics: 8192 bytes read, 0 seeks
[http @ 0x218f600] request: POST /feed1.ffm HTTP/1.1
Transfer-Encoding: chunked
User-Agent: Lavf/55.22.102
Accept: */*
Connection: close
Host: 172.16.0.57:8090

Successfully opened the file.
detected 4 logical cores
[graph 0 input from stream 0:1 @ 0x218b820] Setting 'time_base' to value '1/48000'
[graph 0 input from stream 0:1 @ 0x218b820] Setting 'sample_rate' to value '48000'
[graph 0 input from stream 0:1 @ 0x218b820] Setting 'sample_fmt' to value 's16p'
[graph 0 input from stream 0:1 @ 0x218b820] Setting 'channel_layout' to value '0x3'
[graph 0 input from stream 0:1 @ 0x218b820] tb:1/48000 samplefmt:s16p samplerate:48000 chlayout:0x3
[audio format for output stream 0:0 @ 0x21922a0] Setting 'sample_fmts' to value 'fltp'
[audio format for output stream 0:0 @ 0x21922a0] Setting 'sample_rates' to value '44100'
[audio format for output stream 0:0 @ 0x21922a0] Setting 'channel_layouts' to value '0x3'
[audio format for output stream 0:0 @ 0x21922a0] auto-inserting filter 'auto-inserted resampler 0' between the filter 'Parsed_anull_0' and the filter 'audio format for output stream 0:0'
[AVFilterGraph @ 0x221dd60] query_formats: 5 queried, 9 merged, 3 already done, 0 delayed
[auto-inserted resampler 0 @ 0x224eae0] ch:2 chl:stereo fmt:s16p r:48000Hz -> ch:2 chl:stereo fmt:fltp r:44100Hz
[graph 1 input from stream 0:0 @ 0x224daa0] Setting 'video_size' to value '720x404'
[graph 1 input from stream 0:0 @ 0x224daa0] Setting 'pix_fmt' to value '0'
[graph 1 input from stream 0:0 @ 0x224daa0] Setting 'time_base' to value '1001/24000'
[graph 1 input from stream 0:0 @ 0x224daa0] Setting 'pixel_aspect' to value '0/1'
[graph 1 input from stream 0:0 @ 0x224daa0] Setting 'sws_param' to value 'flags=2'
[graph 1 input from stream 0:0 @ 0x224daa0] Setting 'frame_rate' to value '24000/1001'
[graph 1 input from stream 0:0 @ 0x224daa0] w:720 h:404 pixfmt:yuv420p tb:1001/24000 fr:24000/1001 sar:0/1 sws_param:flags=2
[scaler for output stream 0:1 @ 0x224e020] Setting 'w' to value '1280'
[scaler for output stream 0:1 @ 0x224e020] Setting 'h' to value '720'
[scaler for output stream 0:1 @ 0x224e020] Setting 'flags' to value '0x4'
[scaler for output stream 0:1 @ 0x224e020] w:1280 h:720 flags:'0x4' interl:0
[format @ 0x2179740] compat: called with args=[yuv420p]
[format @ 0x2179740] Setting 'pix_fmts' to value 'yuv420p'
[AVFilterGraph @ 0x224e9c0] query_formats: 6 queried, 5 merged, 0 already done, 0 delayed
[scaler for output stream 0:1 @ 0x224e020] w:720 h:404 fmt:yuv420p sar:0/1 -> w:1280 h:720 fmt:yuv420p sar:0/1 flags:0x4
[libvpx @ 0x224cee0] v1.3.0
[libvpx @ 0x224cee0] --prefix=/home/pferland/ffmpeg_build --disable-examples
[libvpx @ 0x224cee0] vpx_codec_enc_cfg
[libvpx @ 0x224cee0] generic settings

g_usage: 0
g_threads: 0
g_profile: 0
g_w: 320
g_h: 240
g_timebase: {1/30}
g_error_resilient: 0
g_pass: 0
g_lag_in_frames: 0

[libvpx @ 0x224cee0] rate control settings

rc_dropframe_thresh: 0
rc_resize_allowed: 0
rc_resize_up_thresh: 60
rc_resize_down_thresh: 30
rc_end_usage: 0
rc_twopass_stats_in: (nil)(0)
rc_target_bitrate: 256

[libvpx @ 0x224cee0] quantizer settings

rc_min_quantizer: 4
rc_max_quantizer: 63

[libvpx @ 0x224cee0] bitrate tolerance

rc_undershoot_pct: 100
rc_overshoot_pct: 100

[libvpx @ 0x224cee0] decoder buffer model

rc_buf_sz: 6000
rc_buf_initial_sz: 4000
rc_buf_optimal_sz: 5000

[libvpx @ 0x224cee0] 2 pass rate control settings

rc_2pass_vbr_bias_pct: 50
rc_2pass_vbr_minsection_pct: 0
rc_2pass_vbr_maxsection_pct: 400

[libvpx @ 0x224cee0] keyframing settings

kf_mode: 1
kf_min_dist: 0
kf_max_dist: 128

[libvpx @ 0x224cee0]
[libvpx @ 0x224cee0] vpx_codec_enc_cfg
[libvpx @ 0x224cee0] generic settings

g_usage: 0
g_threads: 0
g_profile: 0
g_w: 1280
g_h: 720
g_timebase: {1001/24000}
g_error_resilient: 0
g_pass: 0
g_lag_in_frames: 25

[libvpx @ 0x224cee0] rate control settings

rc_dropframe_thresh: 0
rc_resize_allowed: 0
rc_resize_up_thresh: 60
rc_resize_down_thresh: 30
rc_end_usage: 0
rc_twopass_stats_in: (nil)(0)
rc_target_bitrate: 400

[libvpx @ 0x224cee0] quantizer settings

rc_min_quantizer: 10
rc_max_quantizer: 31

[libvpx @ 0x224cee0] bitrate tolerance

rc_undershoot_pct: 0
rc_overshoot_pct: 100

[libvpx @ 0x224cee0] decoder buffer model

rc_buf_sz: 2000
rc_buf_initial_sz: 1500
rc_buf_optimal_sz: 1666

[libvpx @ 0x224cee0] 2 pass rate control settings

rc_2pass_vbr_bias_pct: 0
rc_2pass_vbr_minsection_pct: 0
rc_2pass_vbr_maxsection_pct: 200

[libvpx @ 0x224cee0] keyframing settings

kf_mode: 1
kf_min_dist: 0
kf_max_dist: 12

[libvpx @ 0x224cee0]
[libvpx @ 0x224cee0] vpx_codec_control
[libvpx @ 0x224cee0] VP8E_SET_CPUUSED: 1
[libvpx @ 0x224cee0] VP8E_SET_ARNR_MAXFRAMES: 0
[libvpx @ 0x224cee0] VP8E_SET_ARNR_STRENGTH: 3
[libvpx @ 0x224cee0] VP8E_SET_ARNR_TYPE: 3
[libvpx @ 0x224cee0] VP8E_SET_NOISE_SENSITIVITY: 0
[libvpx @ 0x224cee0] VP8E_SET_TOKEN_PARTITIONS: 0
[libvpx @ 0x224cee0] VP8E_SET_STATIC_THRESHOLD: 0
[libvpx @ 0x224cee0] VP8E_SET_CQ_LEVEL: 0
[libvpx @ 0x224cee0] Using deadline: 1000000
Output #0, ffm, to 'http://172.16.0.57:8090/feed1.ffm':

Metadata:

creation_time : now
encoder : Lavf55.22.102
Stream #0:0, 0, 1/1000000: Audio: vorbis (libvorbis), 44100 Hz, stereo, fltp, 64 kb/s
Stream #0:1, 0, 1/1000000: Video: vp8 (libvpx), yuv420p, 1280x720, 1001/24000, q=10-31, 400 kb/s, 1000k tbn, 23.98 tbc

Stream mapping:

Stream #0:1 -> #0:0 (mp3 -> libvorbis)
Stream #0:0 -> #0:1 (h264 -> libvpx)

Press [q] to stop, ? for help
[h264 @ 0x22156c0] no picture
[h264 @ 0x22167e0] no picture
* 2 dup!
av_interleaved_write_frame(): Connection reset by peer0.34 bitrate= 192.2kbits/s dup=2 drop=0
[AVIOContext @ 0x221dc40] Statistics: 0 seeks, 2 writeouts

Thanks for the help!

Change History (15)

comment:1 by Stefano Sabatini, 10 years ago

Component: undeterminedFFserver
Keywords: regression ffserver ffm added
Reproduced by developer: set
Status: newopen

I'm able to reproduce the error here, I get this error in the ffserver log upon receiving the second HTTP chunk:

Fri Jan  3 10:23:42 2014 Feed stream has become desynchronized -- disconnecting

Can you show the content of your ffserver log?

Also, can you git bisect to detect the version which introduced the problem?

Info for developers: the failing check is in line 2729 of ffserver.c:

    if (c->buffer_ptr - c->buffer >= 2 && c->data_count > FFM_PACKET_SIZE) {
        if (c->buffer[0] != 'f' ||
            c->buffer[1] != 'm') {
            http_log("Feed stream has become desynchronized -- disconnecting\n");
            goto fail;
        }
    }

If I comment the check streaming seems to work smoothly. Any hint about what's going on?

comment:2 by pferland, 10 years ago

ffserver access.log

Thu Jan 2 19:13:57 2014 Deleting feed file '/tmp/feed1.ffm' as it appears to be corrupt
Thu Jan 2 19:13:57 2014 Deleting feed file '/tmp/feed2.ffm' as it appears to be corrupt
Thu Jan 2 19:13:58 2014 Deleting feed file '/tmp/feed3.ffm' as it appears to be corrupt
Thu Jan 2 19:13:58 2014 Deleting feed file '/tmp/feed4.ffm' as it appears to be corrupt
Thu Jan 2 19:13:58 2014 Deleting feed file '/tmp/feed5.ffm' as it appears to be corrupt
Thu Jan 2 19:13:58 2014 Deleting feed file '/tmp/feed6.ffm' as it appears to be corrupt
Thu Jan 2 19:13:58 2014 FFserver started.
Thu Jan 2 19:14:46 2014 172.16.0.57 - - [GET] "/feed1.ffm HTTP/1.1" 200 4175
Thu Jan 2 19:14:46 2014 Feed stream has become desynchronized -- disconnecting
Thu Jan 2 19:14:46 2014 172.16.0.57 - - [POST] "/feed1.ffm HTTP/1.1" 200 8192
Thu Jan 2 19:15:55 2014 172.16.0.57 - - [GET] "/feed1.ffm HTTP/1.1" 200 8271
Thu Jan 2 19:15:55 2014 Feed stream has become desynchronized -- disconnecting
Thu Jan 2 19:15:55 2014 172.16.0.57 - - [POST] "/feed1.ffm HTTP/1.1" 200 8192

Doing a git bisect now.

comment:3 by pferland, 10 years ago

So I either did the git bisect wrong or the first bad commit is 9c5260e73a7a59fa49cea60a5c041be1a9485385

But I didn't see any commits for ffserver.c in that commit

in reply to:  3 comment:4 by Stefano Sabatini, 10 years ago

Replying to pferland:

So I either did the git bisect wrong or the first bad commit is 9c5260e73a7a59fa49cea60a5c041be1a9485385

git show 9c5260e73a7a59fa49cea60a5c041b
fatal: ambiguous argument '9c5260e73a7a59fa49cea60a5c041b': unknown revision or path not in the working tree.

Please show the exact commit hash, the commit log will be fine as well.

But I didn't see any commits for ffserver.c in that commit

This is natural since there are many components involved with streaming (codecs, muxers, demuxers, protocols, etc.).

comment:5 by pferland, 10 years ago

Crap, I was running the bisect against the source.ffmpeg.org git. Going to re-run with the GitHub repo that I thought I was running against.

comment:6 by pferland, 10 years ago

So I don't know what changed, but I did a pull for the master branch on the GitHub repo and re-compiled and it is working now.
FFmpeg header:

ffserver version N-59498-g9c5260e Copyright (c) 2000-2014 the FFmpeg developers
built on Jan 3 2014 21:50:24 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)

in reply to:  6 comment:7 by Stefano Sabatini, 10 years ago

Replying to pferland:

So I don't know what changed, but I did a pull for the master branch on the GitHub repo and re-compiled and it is working now.
FFmpeg header:

ffserver version N-59498-g9c5260e Copyright (c) 2000-2014 the FFmpeg developers
built on Jan 3 2014 21:50:24 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)

Tested again and is still failing here. Note that source.ffmpeg.org is the correct FFmpeg repository, but GitHub should also be fine. Can you retest and/or tell me which commit resulted to have broken streaming?

comment:8 by Carl Eugen Hoyos, 10 years ago

Just to make sure: The only officially supported path for FFmpeg git is source.ffmpeg.org

comment:9 by pferland, 10 years ago

Deleted all folders for ffmpeg, ran git clone git://source.ffmpeg.org/ffmpeg
compiled and it seems like WebM is working.

ffserver2:~/ffmpeg_sources/ffmpeg$ git rev-parse --verify HEAD
262451878bab87670fba06fa6c9d798a81d39646

ffserver2:~/ffmpeg_sources/ffmpeg$ git remote show origin
* remote origin
  Fetch URL: git://source.ffmpeg.org/ffmpeg
  Push  URL: git://source.ffmpeg.org/ffmpeg
  HEAD branch: master
  Remote branches:
    master       tracked
    oldabi       tracked
    release/0.10 tracked
    release/0.11 tracked
    release/0.5  tracked
    release/0.6  tracked
    release/0.7  tracked
    release/0.8  tracked
    release/0.9  tracked
    release/1.0  tracked
    release/1.1  tracked
    release/1.2  tracked
    release/2.0  tracked
    release/2.1  tracked
  Local branch configured for 'git pull':
    master merges with remote master
  Local ref configured for 'git push':
    master pushes to master (up to date)

comment:10 by pferland, 10 years ago

But the performance for the master branch is much worse than the 1.0.8 branch I had been using. The 1.0.8 branch ffmpeg can stream at about 24-28fps while the master branch can barely get 16 fps and levels out at 11 fps.

in reply to:  9 comment:11 by Stefano Sabatini, 10 years ago

Replying to pferland:

Deleted all folders for ffmpeg, ran git clone git://source.ffmpeg.org/ffmpeg
compiled and it seems like WebM is working.

What version of libvpx are you running? Also did you change something relevant in the system between the various tests?

comment:12 by Stefano Sabatini, 10 years ago

Weird, if I set:

    AudioCodec vorbis
    AudioBitRate 64
    AudioChannels 1
    AudioSampleRate 44100

    VideoCodec libvpx
    VideoSize qcif
    VideoFrameRate 25
    VideoBitRate 400
    VideoQMin 10
    VideoQMax 31
    VideoGopSize 12

    AVOptionVideo flags +global_header
    AVOptionAudio flags +global_header

I don't get the error.

If I set AudioChannels to 2 I'm able to reproduce the error. libvpx alone or libvorbis alone won't cause the problem, but libvpx+libvorbis with 2 channels will. Video parameters seem to be uninfluent as well.

comment:13 by pferland, 10 years ago

I do not recall updating the libvpx source in between nor the system. I still have AudioChannels set to 2. But I have noticed if I try and change the VideoSize from anything other than vga I get: Image size must be a multiple of 16. qcif and qvga work, but are really low resolutions.

comment:14 by pferland, 10 years ago

oops forgot the libvpx version

[libvpx @ 0x20c7b20] v1.3.0

comment:15 by Rostislav Pehlivanov, 6 years ago

Resolution: invalid
Status: openclosed

ffserver was removed from git master, closing bug as invalid

Note: See TracTickets for help on using tickets.