Opened 4 years ago

Last modified 3 years ago

#3139 new defect

ffserver says invalid stream index after feed file reaches maximum value in rtsp live streaming

Reported by: Ashutosh Owned by:
Priority: normal Component: ffserver
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

The current scenario:
I am using ffserver for live streaming.ffserver.conf file is as follows:
Port 8090
BindAddress? 0.0.0.0
MaxHTTPConnections 2000
MaxClients? 1000
MaxBandwidth? 1000
CustomLog? -

RTSPPort 7654
RTSPBindAddress 0.0.0.0
NoDaemon?

<Feed exile1.ffm>
#ffmpeg http://localhost:8090/exile1.ffm
File exile%d.ffm
FileMaxSize? 10M
#Launch ffmpeg -i E:\ashu\ezio.mp4
ACL allow 127.0.0.1
ACL allow localhost
</Feed>

# if you want to use mpegts format instead of flv
# then change "live.flv" to "live.ts"
# and also change "Format flv" to "Format mpegts"
<Stream live.h264>

Format rtp
NoAudio?
Feed exile1.ffm
#File "rtsp://127.0.0.1:8554/live.sdp?tcp"
VideoCodec? libx264
VideoFrameRate? 10
VideoBitRate? 530
VideoSize? 640x480
VideoBufferSize? 40000


AVOptionVideo me_range 16

AVOptionVideo qcomp 0.6
AVOptionVideo qmin 10
VideoGopSize? 12
PreRoll? 15
#Strict -1

#NoLoop?
#StartSendOnKey?

# AVOptionVideo flags +global_header

</Stream>
<Stream status.html> # Server status URL

Format status
# Only allow local people to get the status
ACL allow localhost
ACL allow 192.168.0.0 192.168.255.255

</Stream>

i transcode a video and push the output to feed file as follows:

ffmpeg -i input.h264 http://localhost:8090/exile1.ffm

and i play the video using ffplay using the command line as follows:

ffplay -i rtsp://<IP>:7654/live.h264

<IP> - IP address.

I ran first ffserver in one console window,ffmpeg in other console window and ffplay in other console window.
The video plays normally by the way.
When ffmpeg saves the streams to exile1.ffm it's file size increases.When filesize reaches max value i.e 10 M ,ffserver says

[ffm 0x80048fe0 ] inavlid stream index 143

and ffplay stops playing and says.

Cannot use next picture in error concealment.

I need to play the video continously without increasing the maximum size of the feed file.

Any advice is highly appreciated.

Change History (3)

comment:1 Changed 4 years ago by cehoyos

  • Keywords ffserver feed file removed
  • Priority changed from critical to normal

Is this problem only reproducible using external libraries (libx264) or also with a native encoder?
To make this a valid ticket, please test current FFmpeg git head and provide your command lines together with the complete, uncut console output.

comment:2 Changed 3 years ago by retrry

  • Version changed from 2.0.2 to 2.6.2

I ran into this same problem, using freshly compiled ffmpeg 2.6.3. I tried to use native mpeg4 encoder and libx264 encoder - both have same result. After some time it trows error: Invalid stream index. I think this is connected to ffm file size, because as you increase size of ffm file you can delay the problem. I add my ffserver.conf, ffserver log and ffmpeg command with console output. Do you need any additional information?

ffserver.conf

HTTPPort 8090
HTTPBindAddress 127.0.0.1
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 100000
CustomLog -

<Feed feed1.ffm>
    File /tmp/feed1.ffm
    FileMaxSize 40M
    ACL allow 127.0.0.1
</Feed>

<Stream image>
    Format mpegts
    Feed feed1.ffm
 
    VideoCodec libx264
    VideoFrameRate 25
    PixelFormat yuv420p
    VideoSize 1280x720
    VideoBitRate 500
    AVOptionVideo preset ultrafast
    AVOptionVideo profile baseline
    AVOptionVideo level 3.0
    NoAudio
</Stream>

<Stream stat.html>
Format status
# Only allow local people to get the status
ACL allow 127.0.0.1
ACL allow 192.168.0.0 192.168.255.255
</Stream>

ffserver log

[root@my-secret-vps ~]# ffserver -d
ffserver version 2.6.3 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.8.3 (GCC) 20140911 (Red Hat 4.8.3-9)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-libass --enable-libcdio --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 25.101 / 56. 25.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 11.102
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
/etc/ffserver.conf:27: Setting default value for video bit rate tolerance = 125000. Use NoDefaults to disable it.
/etc/ffserver.conf:27: Setting default value for video rate control equation = tex^qComp. Use NoDefaults to disable it.
/etc/ffserver.conf:27: Setting default value for video max rate = 1000000. Use NoDefaults to disable it.
/etc/ffserver.conf:27: Setting default value for video buffer size = 1000000. Use NoDefaults to disable it.
Wed Jun 10 02:43:07 2015 FFserver started.
Wed Jun 10 02:43:14 2015 127.0.0.1 - - New connection: GET /feed1.ffm
Wed Jun 10 02:43:14 2015 127.0.0.1 - - [GET] "/feed1.ffm HTTP/1.1" 200 4175
Wed Jun 10 02:43:14 2015 127.0.0.1 - - New connection: POST /feed1.ffm
Wed Jun 10 02:43:22 2015 127.0.0.1 - - New connection: GET /image
Wed Jun 10 02:53:32 2015 [ffm @ 0x76ab60]invalid stream index 137
Wed Jun 10 02:54:14 2015 [ffm @ 0x76ab60]invalid stream index 58
Wed Jun 10 02:54:14 2015 [ffm @ 0x76ab60]invalid stream index 154
Wed Jun 10 02:54:14 2015 [ffm @ 0x76ab60]invalid stream index 196
Wed Jun 10 02:54:14 2015 [ffm @ 0x76ab60]invalid stream index 242
Wed Jun 10 02:54:14 2015 [ffm @ 0x76ab60]invalid stream index 120
Wed Jun 10 02:54:14 2015 [ffm @ 0x76ab60]invalid stream index 8
Wed Jun 10 02:54:14 2015 [ffm @ 0x76ab60]invalid stream index 225
Wed Jun 10 02:54:14 2015 [ffm @ 0x76ab60]invalid stream index 189
Wed Jun 10 02:54:14 2015 [ffm @ 0x76ab60]invalid stream index 162
Wed Jun 10 02:54:14 2015 [ffm @ 0x76ab60]invalid stream index 155
Wed Jun 10 02:54:14 2015 [ffm @ 0x76ab60]invalid stream index 229
Wed Jun 10 02:54:15 2015 [ffm @ 0x76ab60]invalid stream index 128
Wed Jun 10 02:54:16 2015 [ffm @ 0x76ab60]invalid stream index 208
Wed Jun 10 02:54:16 2015 [ffm @ 0x76ab60]invalid stream index 168
Wed Jun 10 02:54:16 2015 [mpegts @ 0x76a2f0]H.264 bitstream error, startcode missing, size 12388932 data 7E367323
Wed Jun 10 02:54:19 2015 [ffm @ 0x76ab60]invalid stream index 42

ffmpeg to ffserver log

[root@my-secret-vps ~]# /usr/bin/ffmpeg -loop 1 -i /srv/img.jpg -force_key_frames 'expr:gte(t,n_forced*2)' -nostats -nostdin http://127.0.0.1:8090/feed1.ffm
ffmpeg version 2.6.3 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.8.3 (GCC) 20140911 (Red Hat 4.8.3-9)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-libass --enable-libcdio --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 25.101 / 56. 25.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 11.102
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, image2, from '/srv/img.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 53390 kb/s
    Stream #0:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 1280x720, 25 fps, 25 tbr, 25 tbn, 25 tbc
[swscaler @ 0x248fe80] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0x24a9f00] frame MB size (80x45) > level limit (1620)
[libx264 @ 0x24a9f00] MB rate (90000) > level limit (40500)
[libx264 @ 0x24a9f00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x24a9f00] profile Constrained Baseline, level 3.0
Output #0, ffm, to 'http://127.0.0.1:8090/feed1.ffm':
  Metadata:
    creation_time   : now
    encoder         : Lavf56.25.101
    Stream #0:0: Video: h264 (libx264), yuv420p, 1280x720, q=-1--1, 500 kb/s, 25 fps, 1000k tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.26.100 libx264
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))

ffmpeg from ffserver log

[root@my-secret-vps ~]# /usr/bin/ffmpeg -analyzeduration 10000000 -probesize 50000000 -i http://127.0.0.1:8090/image -i http://127.0.0.1:8000/radio.mp3 -vcodec copy -acodec aac -strict experimental -ar 11025 -ab 96000 -ar 48000 -profile:a aac_low -hls_wrap 100 -hls_time 10 -nostats -nostdin radio.m3u8
ffmpeg version 2.6.3 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.8.3 (GCC) 20140911 (Red Hat 4.8.3-9)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-libass --enable-libcdio --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 25.101 / 56. 25.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 11.102
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
[h264 @ 0x1d9e5e0] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0x1d9e5e0] decode_slice_header error
[h264 @ 0x1d9e5e0] no frame!
[h264 @ 0x1d9e5e0] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0x1d9e5e0] decode_slice_header error
[h264 @ 0x1d9e5e0] no frame!
[h264 @ 0x1d9e5e0] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0x1d9e5e0] decode_slice_header error
[h264 @ 0x1d9e5e0] no frame!
[h264 @ 0x1d9e5e0] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0x1d9e5e0] decode_slice_header error
[h264 @ 0x1d9e5e0] no frame!
[h264 @ 0x1d9e5e0] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0x1d9e5e0] decode_slice_header error
[h264 @ 0x1d9e5e0] no frame!
[h264 @ 0x1d9e5e0] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0x1d9e5e0] decode_slice_header error
[h264 @ 0x1d9e5e0] no frame!
[h264 @ 0x1d9e5e0] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0x1d9e5e0] decode_slice_header error
[h264 @ 0x1d9e5e0] no frame!
[h264 @ 0x1d9e5e0] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0x1d9e5e0] decode_slice_header error
[h264 @ 0x1d9e5e0] no frame!
[h264 @ 0x1d9e5e0] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0x1d9e5e0] decode_slice_header error
[h264 @ 0x1d9e5e0] no frame!
[h264 @ 0x1d9e5e0] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0x1d9e5e0] decode_slice_header error
[h264 @ 0x1d9e5e0] no frame!
Input #0, mpegts, from 'http://127.0.0.1:8090/image':
  Duration: N/A, start: 46034.159822, bitrate: N/A
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 1280x720, 25 fps, 25 tbr, 90k tbn, 50 tbc
[mp3 @ 0x1da25a0] Header missing
    Last message repeated 1 times
Input #1, mp3, from 'http://127.0.0.1:8000/radio.mp3':
  Metadata:
    icy-br          : 140
    icy-irc         : shoutcast
    icy-name        : Hit Radio
    icy-pub         : 1
    StreamTitle     : 
  Duration: N/A, start: 0.000000, bitrate: 167 kb/s
    Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 167 kb/s
Output #0, hls, to 'radio.m3u8':
  Metadata:
    encoder         : Lavf56.25.101
    Stream #0:0: Video: h264 ([27][0][0][0] / 0x001B), yuv420p, 1280x720, q=2-31, 25 fps, 25 tbr, 90k tbn, 25 tbc
    Stream #0:1: Audio: aac, 48000 Hz, stereo, fltp, 96 kb/s
    Metadata:
      encoder         : Lavc56.26.100 aac
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (mp3 (native) -> aac (native))
[mpegts @ 0x1d98ea0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[mp3 @ 0x1dc2820] Header missing
[mp3 @ 0x1dbd6c0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
Error while decoding stream #1:0: Invalid data found when processing input
[mp3 @ 0x1dc2820] Header missing
Error while decoding stream #1:0: Invalid data found when processing input
[mp3 @ 0x1dc2820] incomplete frame
Error while decoding stream #1:0: Invalid data found when processing input
[NULL @ 0x1d9e5e0] sps_id 32 out of range
[NULL @ 0x1d9e5e0] pps_id 311 out of range
[NULL @ 0x1d9e5e0] SEI type 0 size 1248 truncated at 80
Last edited 3 years ago by retrry (previous) (diff)

comment:3 Changed 3 years ago by retrry

  • Version changed from 2.6.2 to git-master

Just tested on newly released 2.7. It still has same problem.

Note: See TracTickets for help on using tickets.