Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hls stops working: force fragment split #568

Open
vvidic opened this issue Jan 23, 2015 · 15 comments
Open

hls stops working: force fragment split #568

vvidic opened this issue Jan 23, 2015 · 15 comments

Comments

@vvidic
Copy link

vvidic commented Jan 23, 2015

Any idea why this configuration stops working after a few days:

worker_processes 4;
pid /run/nginx.pid;
#error_log  /var/log/nginx/debug.log debug;

events {
     worker_connections 1024;
     multi_accept on;
 }

 rtmp_auto_push on;
 rtmp {
    server {
        listen 1935;

        application student {
            live on;

            hls on;
            hls_path /run/shm/hls-student;

            dash on;
            dash_path /run/shm/dash-student;

            # pull to start hls export
            pull rtmp://lb.av.carnet.hr/student name=one static;
         }
}
2015/01/23 09:22:45 [error] 16433#0: *1 hls: force fragment split: 682283.103 sec, , client: lb.av.carnet.hr/student, server: ngx-relay
2015/01/23 09:22:45 [error] 16433#0: *1 hls: force fragment split: -682275.068 sec, , client: lb.av.carnet.hr/student, server: ngx-relay
2015/01/23 09:22:53 [error] 16433#0: *1 hls: force fragment split: 682275.068 sec, , client: lb.av.carnet.hr/student, server: ngx-relay
2015/01/23 09:22:53 [error] 16433#0: *1 hls: force fragment split: -682267.034 sec, , client: lb.av.carnet.hr/student, server: ngx-relay
2015/01/23 09:23:01 [error] 16433#0: *1 hls: force fragment split: 682267.034 sec, , client: lb.av.carnet.hr/student, server: ngx-relay
2015/01/23 09:23:01 [error] 16433#0: *1 hls: force fragment split: -682259.000 sec, , client: lb.av.carnet.hr/student, server: ngx-relay
2015/01/23 09:23:09 [error] 16433#0: *1 hls: force fragment split: 682259.000 sec, , client: lb.av.carnet.hr/student, server: ngx-relay
2015/01/23 09:23:09 [error] 16433#0: *1 hls: force fragment split: -682250.943 sec, , client: lb.av.carnet.hr/student, server: ngx-relay
2015/01/23 09:23:17 [error] 16433#0: *1 hls: force fragment split: 682250.943 sec, , client: lb.av.carnet.hr/student, server: ngx-relay
2015/01/23 09:23:17 [error] 16433#0: *1 hls: force fragment split: -682242.909 sec, , client: lb.av.carnet.hr/student, server: ngx-relay
@mknwebsolutions
Copy link

I believe this is the same issue @ #346

@vvidic
Copy link
Author

vvidic commented Jan 25, 2015

On Sat, Jan 24, 2015 at 01:42:56PM -0800, Michael Mikhjian wrote:

I believe this is the same issue @ #346

It could be, however I'm using the latest git version (7a35372).
Restarting nginx doesn't help as the errors start appearing right
away. I have to restart the upstream RTMP server to get HLS working
again but this is not very practical for live streams. I have
a capture of the failing RTMP stream so maybe you can use this
to figure out why the HLS generator stops working.

Valentin

@dburianov
Copy link

I have it problem too and nginx create more small files about 300-15000 bytes size.

2016/02/14 14:05:53 [error] 952#0: *18459 hls: force fragment split: -78.252 sec, , client: 127.0.0.1, server: 0.0.0.0:1935
2016/02/14 14:05:53 [error] 952#0: *18460 hls: force fragment split: 78.391 sec, , client: 127.0.0.1, server: 0.0.0.0:1935

It work only in this config:
hls on;
hls_path /usr/local/nginx/html/video;
hls_fragment 10s;
hls_playlist_length 60s;
hls_continuous on;
hls_fragment_naming timestamp;
dash off;
dash_path /usr/local/nginx/html/dash;
dash_fragment 15s;
dash_playlist_length 60s;

dash off and dash* present
If I comment or remove dash* in config I have this errors.

Sometimes I have nest errors in ffmpeg logs:

Error while decoding stream #0:1: Invalid data found when processing input
[mpegts @ 0x3868740] PES packet size mismatchme=00:21:51.90 bitrate= 828.8kbits/s speed=0.933x
[mpeg2video @ 0x38db0a0] 00 motion_type at 3 32
[mpeg2video @ 0x38db0a0] 00 motion_type at 6 24
[mpeg2video @ 0x38db0a0] 00 motion_type at 5 25
[mpeg2video @ 0x38db0a0] mb incr damaged
[mpeg2video @ 0x38db0a0] 00 motion_type at 12 27
[mpeg2video @ 0x38db0a0] 00 motion_type at 12 33
[mpeg2video @ 0x38db0a0] 00 motion_type at 4 28
[mpeg2video @ 0x38db0a0] 00 motion_type at 25 34
[mpeg2video @ 0x38db0a0] 00 motion_type at 5 16
[mpeg2video @ 0x38db0a0] 00 motion_type at 26 35
[mpeg2video @ 0x38db0a0] ac-tex damaged at 29 20
[mpeg2video @ 0x38db0a0] 00 motion_type at 4 21
[mpeg2video @ 0x38db0a0] invalid mb type in P Frame at 21 22
[mpeg2video @ 0x38db0a0] 00 motion_type at 2 23
[mpeg2video @ 0x38db0a0] 00 motion_type at 5 8
[mpeg2video @ 0x38db0a0] mb incr damaged
[mpeg2video @ 0x38db0a0] 00 motion_type at 18 9
[mpeg2video @ 0x38db0a0] 00 motion_type at 1 13
[mpeg2video @ 0x38db0a0] 00 motion_type at 15 10
[mpeg2video @ 0x38db0a0] 00 motion_type at 9 14
[mpeg2video @ 0x38db0a0] 00 motion_type at 9 11
[mpeg2video @ 0x38db0a0] 00 motion_type at 2 15
[mpeg2video @ 0x38db0a0] 00 motion_type at 11 7
[mpeg2video @ 0x38db0a0] 00 motion_type at 7 1
[mpeg2video @ 0x38db0a0] mb incr damaged
[mpeg2video @ 0x38db0a0] 00 motion_type at 8 3
[mpeg2video @ 0x38db0a0] 00 motion_type at 1 4
[mpeg2video @ 0x38db0a0] invalid cbp -1 at 2 5
[mpeg2video @ 0x38db0a0] 00 motion_type at 10 6
[mpeg2video @ 0x38db0a0] invalid cbp -1 at 9 7
[mpeg2video @ 0x38db0a0] 00 motion_type at 6 29
[mpeg2video @ 0x38db0a0] ac-tex damaged at 5 30
[mpeg2video @ 0x38db0a0] ac-tex damaged at 9 17
[mpeg2video @ 0x38db0a0] 00 motion_type at 13 31
[mpeg2video @ 0x38db0a0] invalid cbp -1 at 9 19
[mpeg2video @ 0x38db0a0] 00 motion_type at 12 19
[mpeg2video @ 0x38db0a0] Warning MVs not available
[mpeg2video @ 0x38db0a0] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
[mp2 @ 0x386ad60] Header missing
Error while decoding stream #0:1: Invalid data found when processing input

ffmpeg get mpeg2 stream via http.

Sometimes I have next message:
[libfdk_aac @ 0x388f220] Queue input is backward in time
[flv @ 0x38d2880] Non-monotonous DTS in output stream 0:1; previous: 1437181, current: 1437173; changing to 1437181. This may result in incorrect timestamps in the output file.

but it does not lead to error

nginx 1.9.9
ffmpeg version N-78299-gf021030 - compiling from sources

I use script when monitoring folder and do next:
stop nginx
remove *.ts files with small size
start nginx

@guoyi8
Copy link

guoyi8 commented Aug 14, 2016

@dburianov
I also have this problem.
Have you solved it?

@aaronpk
Copy link

aaronpk commented Nov 16, 2016

I'm having this problem as well, but only when streaming from Larix Broadcaster on iOS. Streaming from OBS on my Mac works fine.

@alphacentauri82
Copy link

i have the same problem. And i have NO IDEA!

@dburianov
Copy link

It problem your based on audiocodec
Sometimes it been repaired with change audiocodec or in serials encoding(as enc only video and audio copy and next video copy and audio to aac)

@alphacentauri82
Copy link

How do i fix it?. That's the question. I can see the stream just fine but it's jumpy and delayed at times.

@milesegan
Copy link

I'm seeing this issue too. Has anyone found a solution?

@campones
Copy link

i have this while using an rtmp application that push the original stream toward several servers. starts creating thousands or mini segments

f6aa9ac39d5d0a8340d583c8d91548ed

@dburianov
Copy link

Now I use build ffmpeg from source code and do not have this problem
ffmpeg 3.4.2
./configure
--prefix="/usr/ffmpeg_build"
--pkg-config-flags="--static"
--extra-cflags="-I/usr/ffmpeg_build/include"
--extra-ldflags="-L/usr/ffmpeg_build/lib"
--extra-libs="-lpthread -lm"
--bindir="/usr/bin"
--enable-gpl
--enable-libass
--enable-libfdk-aac
--enable-libfreetype
--enable-libmp3lame
--enable-libopus
--enable-libtheora
--enable-libvorbis
--enable-libvpx
--enable-libx264
--enable-libx265
--enable-nonfree
--enable-filter=movie --enable-filter=drawtext --enable-libfreetype --enable-filter=overlay --enable-filter=yadif

@hgshoggins
Copy link

hgshoggins commented May 4, 2019

Having the same problem here. @dburianov, do you have an idea about what has changed from your distribution version to your own ffmpeg compilation? I'm using ffmpeg 4.0.4 from Fedora 29.

What happens to me looks like a (I know I'm not using the appropriate words) "desync" with the chunk size or something like that:
2019/05/04 15:25:05 [error] 969#0: *101 hls: force fragment split: 10.007 sec, , client: 127.0.0.1, server: 0.0.0.0:1935 2019/05/04 15:25:15 [error] 969#0: *101 hls: force fragment split: 10.008 sec, , client: 127.0.0.1, server: 0.0.0.0:1935 2019/05/04 15:25:25 [error] 969#0: *101 hls: force fragment split: 10.008 sec, , client: 127.0.0.1, server: 0.0.0.0:1935

@mkrn
Copy link

mkrn commented Oct 30, 2020

The issue is happening when the audio and video timestamps are starting from the different start timestamp. This is valid, however the nginx-rtmp library hls splitter does not account for this, taking dts for timestamp and assumes that they have the same start in audio and video.

To fix it I used -vf "setpts=PTS-STARTPTS" -af "asetpts=PTS-STARTPTS" as ffmpeg options.

Note: the nginx-rtmp interleave and sync options may mess around with timestamps even further.

@lve4code
Copy link

image

I am facing the same issue. Is there any updated solution to this error?

@IgorDePaula
Copy link

Now I use build ffmpeg from source code and do not have this problem ffmpeg 3.4.2 ./configure --prefix="/usr/ffmpeg_build" --pkg-config-flags="--static" --extra-cflags="-I/usr/ffmpeg_build/include" --extra-ldflags="-L/usr/ffmpeg_build/lib" --extra-libs="-lpthread -lm" --bindir="/usr/bin" --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree --enable-filter=movie --enable-filter=drawtext --enable-libfreetype --enable-filter=overlay --enable-filter=yadif

You are using ffmpeg fron source, but how, where?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests