Opened 7 years ago

Closed 7 years ago

#6573 closed defect (fixed)

lost sound when timestamp discontinuity appears with HLC encoder

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

Description

all report in file

Attachments (2)

ffmpeg-20170808-100442.log (398.3 KB ) - added by krs_vital 7 years ago.
ffmpeg report
ffmpeg.c (166.2 KB ) - added by krs_vital 7 years ago.

Download all attachments as: .zip

Change History (17)

by krs_vital, 7 years ago

Attachment: ffmpeg-20170808-100442.log added

ffmpeg report

comment:1 by krs_vital, 7 years ago

[NULL @ 0x25fb220] ct_type:0 pic_struct:2
timestamp discontinuity -10080000, new offset= -14766634989
[hls @ 0x262ab20] Delay between the first packet and last packet in the muxing queue is 10020000 > 10000000: forcing output

after these messages sound lost and i have to restart ffmpeg to solve this problem

comment:2 by Steven Liu, 7 years ago

upload the source file please, and use file test again, maybe the problem is happened with udp input.

Last edited 7 years ago by Steven Liu (previous) (diff)

comment:3 by krs_vital, 7 years ago

today I managed to record what is obtained at the output (HLS) and the input (UDP) as well as a full report about the behavior of ffmpeg. All of this is in the archive from the link below, a little explain: when there is "Continuity counter error" ffmpeg is stopped at this error message for 10 seconds, then have HLS says that you have exceeded the limit of idle frames, the limit is just set to 10 seconds and then another voznikaet error PES packet size mismatch, then an error timestamp discontinuity 10104000, new offset -37818881300 and so on. At this time, the output HLS sound disappears. Only helps restart ffmpeg.

https://mycloud.g-service.ru/owncloud/index.php/s/ehmnswF23ROLgJG

comment:4 by krs_vital, 7 years ago

Component: undeterminedavformat
Priority: normalcritical
Version: unspecifiedgit-master

comment:6 by krs_vital, 7 years ago

i made record this file with ffmpeg with report, link here:
https://mycloud.g-service.ru/owncloud/index.php/s/TDPwTU0MMTTiJGG

I noticed that after 852 of the frame appears an error of this kind:

frame= 852 fps= 21 q=31.0 size= 9728kB time=00:00:36.00 bitrate=2213.7kbits/

[h264 @ 0x37cb960] reference picture missing during reorder
[h264 @ 0x37cb960] Missing reference picture, default is 2147483647
[mpegts @ 0x3576980] PES packet size mismatch
[mp2 @ 0x35a0b00] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
[h264 @ 0x37bd540] mmco: unref short failure
[h264 @ 0x3855800] reference picture missing during reorder

Last message repeated 1 times
[h264 @ 0x3855800] Missing reference picture, default is 67380

Last message repeated 1 times
[h264 @ 0x36636a0] mmco: unref short failure
[h264 @ 0x37ebb40] mmco: unref short failure
[h264 @ 0x37a2aa0] reference picture missing during reorder
[h264 @ 0x37a2aa0] Missing reference picture, default is 67388
[h264 @ 0x37cb960] mmco: unref short failure

!!! Error while decoding stream #0:1: Invalid data found when processing input

after this sound lost

comment:7 by Carl Eugen Hoyos, 7 years ago

Priority: criticalnormal

I tested the following:

$ ffmpeg -i Shant_Premium.ts -c copy out.ts
ffmpeg version N-86977-g5859b5b Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.3.0 (GCC)
  configuration: --enable-gpl
  libavutil      55. 73.100 / 55. 73.100
  libavcodec     57.102.100 / 57.102.100
  libavformat    57. 76.100 / 57. 76.100
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 98.100 /  6. 98.100
  libswscale      4.  7.102 /  4.  7.102
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] decode_slice_header error
[h264 @ 0x3f26ea0] no frame!
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] decode_slice_header error
[h264 @ 0x3f26ea0] no frame!
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] decode_slice_header error
[h264 @ 0x3f26ea0] no frame!
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] decode_slice_header error
[h264 @ 0x3f26ea0] no frame!
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] decode_slice_header error
[h264 @ 0x3f26ea0] no frame!
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] decode_slice_header error
[h264 @ 0x3f26ea0] no frame!
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] decode_slice_header error
[h264 @ 0x3f26ea0] no frame!
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] decode_slice_header error
[h264 @ 0x3f26ea0] no frame!
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] decode_slice_header error
[h264 @ 0x3f26ea0] no frame!
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] decode_slice_header error
[h264 @ 0x3f26ea0] no frame!
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] decode_slice_header error
[h264 @ 0x3f26ea0] no frame!
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] decode_slice_header error
[h264 @ 0x3f26ea0] no frame!
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] decode_slice_header error
[h264 @ 0x3f26ea0] no frame!
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] decode_slice_header error
[h264 @ 0x3f26ea0] no frame!
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] decode_slice_header error
[h264 @ 0x3f26ea0] no frame!
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] decode_slice_header error
[h264 @ 0x3f26ea0] no frame!
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] decode_slice_header error
[h264 @ 0x3f26ea0] no frame!
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] decode_slice_header error
[h264 @ 0x3f26ea0] no frame!
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] decode_slice_header error
[h264 @ 0x3f26ea0] no frame!
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] decode_slice_header error
[h264 @ 0x3f26ea0] no frame!
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] decode_slice_header error
[h264 @ 0x3f26ea0] no frame!
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] decode_slice_header error
[h264 @ 0x3f26ea0] no frame!
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x3f26ea0] SPS unavailable in decode_picture_timing
[h264 @ 0x3f26ea0] non-existing PPS 0 referenced
[h264 @ 0x3f26ea0] decode_slice_header error
[h264 @ 0x3f26ea0] no frame!
[mpegts @ 0x3f223c0] PES packet size mismatch
Input #0, mpegts, from 'Shant_Premium.ts':
  Duration: 00:01:48.30, start: 39165.377300, bitrate: 4217 kb/s
  Program 50
    Metadata:
      service_name    : Shant Premium HD
      service_provider: Shant TV
    Stream #0:0[0x1f5]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x1f6](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 128 kb/s
Output #0, mpegts, to 'out.ts':
  Metadata:
    encoder         : Lavf57.76.100
    Stream #0:0: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 50 tbr, 90k tbn, 90k tbc
    Stream #0:1(eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mpegts @ 0x3f223c0] PES packet size mismatch
    Last message repeated 1 times
frame= 4814 fps=0.0 q=-1.0 Lsize=   48456kB time=00:01:48.08 bitrate=3672.7kbits/s speed= 822x
video:42856kB audio:1512kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 9.215338%

I don't see a line Error while decoding stream #0:1 and the output file plays not worse than the input file.

comment:8 by krs_vital, 7 years ago

yes, from file this error is absent!
but if to stream this file to udp with multicat (Shant_Premium.aux is needed for this tool)

/usr/local/bin/multicat -t 10 ./Shant_Premium.ts 239.192.100.100 (it reproduce udp input)

and then launch

ffmpeg -i udp://@239.192.100.100:1234 -c copy ./out.ts

this error appears!!

comment:9 by krs_vital, 7 years ago

I analyzed the incoming stream and realized that the problem occurs in cases where the flow disappears(the problem with the satellite signal) and appears again, in some cases ffmpeg cannot correctly decode the audio frame after the onset of flow and after that the sound on HLS output is not restored.

comment:10 by Carl Eugen Hoyos, 7 years ago

I tested the following:

$ ffmpeg -i udp://@239.192.100.100:1234 -c copy -t 90 out.ts

and in another console

$ multicat -t 10 ./Shant_Premium.ts 239.192.100.100

The output file out.ts plays as good as Shant_Premium.ts with FFplay, I can hear audio for approximately 90 seconds.

Console output:

$ ffmpeg -i udp://@239.192.100.100:1234 -c copy -t 90 out.ts
ffmpeg version N-87001-gf454416 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.3.0 (GCC)
  configuration: --enable-gpl
  libavutil      55. 74.100 / 55. 74.100
  libavcodec     57.102.100 / 57.102.100
  libavformat    57. 76.100 / 57. 76.100
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 99.100 /  6. 99.100
  libswscale      4.  7.102 /  4.  7.102
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
[h264 @ 0x37db540] non-existing SPS 0 referenced in buffering period
[h264 @ 0x37db540] SPS unavailable in decode_picture_timing
[h264 @ 0x37db540] non-existing PPS 0 referenced
[h264 @ 0x37db540] non-existing SPS 0 referenced in buffering period
[h264 @ 0x37db540] SPS unavailable in decode_picture_timing
[h264 @ 0x37db540] non-existing PPS 0 referenced
[h264 @ 0x37db540] decode_slice_header error
[h264 @ 0x37db540] no frame!

...

[h264 @ 0x37db540] non-existing SPS 0 referenced in buffering period
[h264 @ 0x37db540] SPS unavailable in decode_picture_timing
[h264 @ 0x37db540] non-existing PPS 0 referenced
[h264 @ 0x37db540] non-existing SPS 0 referenced in buffering period
[h264 @ 0x37db540] SPS unavailable in decode_picture_timing
[h264 @ 0x37db540] non-existing PPS 0 referenced
[h264 @ 0x37db540] decode_slice_header error
[h264 @ 0x37db540] no frame!
Input #0, mpegts, from 'udp://@239.192.100.100:1234':
  Duration: N/A, start: 39165.377300, bitrate: N/A
  Program 50
    Metadata:
      service_name    : Shant Premium HD
      service_provider: Shant TV
    Stream #0:0[0x1f5]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x1f6](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 128 kb/s
Output #0, mpegts, to 'out.ts':
  Metadata:
    encoder         : Lavf57.76.100
    Stream #0:0: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 50 tbr, 90k tbn, 90k tbc
    Stream #0:1(eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mpegts @ 0x37b63e0] PES packet size mismatchme=00:00:37.46 bitrate=3750.7kbits/s speed=0.914x
frame= 3909 fps= 41 q=-1.0 Lsize=   39481kB time=00:01:29.98 bitrate=3594.4kbits/s speed=0.947x
video:34744kB audio:1406kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 9.214217%

comment:11 by krs_vital, 7 years ago

ok, now try to test hls output instead ts with udp input.

ffmpeg -report -i udp://@239.192.100.100:1234 -c copy -sn -dn -f hls out.m3u8

comment:12 by krs_vital, 7 years ago

lets se my changes of ffmpeg.c, it solve problem when signal down more then 10 seconds

this change duration after discontinuity PTS and DTS correcting, now it makes before

diff -u ./ffmpeg.c /var/db/pack/FFmpeg/ffmpeg.c
--- ./ffmpeg.c 2017-08-23 13:33:15.457301967 +0700
+++ /var/db/pack/FFmpeg/ffmpeg.c 2017-08-25 20:03:24.607099912 +0700
@@ -4369,16 +4369,6 @@

}

}

-- duration = av_rescale_q(ifile->duration, ifile->time_base, ist->st->time_base);
-- if (pkt.pts != AV_NOPTS_VALUE) {
-- pkt.pts += duration;
-- ist->max_pts = FFMAX(pkt.pts, ist->max_pts);
-- ist->min_pts = FFMIN(pkt.pts, ist->min_pts);
-- }
--
-- if (pkt.dts != AV_NOPTS_VALUE)
-- pkt.dts += duration;
--

pkt_dts = av_rescale_q_rnd(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);

if ((ist->dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO

ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) &&

@@ -4415,8 +4405,17 @@

}

}

-- if (pkt.dts != AV_NOPTS_VALUE)
+ duration = av_rescale_q(ifile->duration, ifile->time_base, ist->st->time_base);
+ if (pkt.pts != AV_NOPTS_VALUE) {
+ pkt.pts += duration;
+ ist->max_pts = FFMAX(pkt.pts, ist->max_pts);
+ ist->min_pts = FFMIN(pkt.pts, ist->min_pts);
+ }
+
+ if (pkt.dts != AV_NOPTS_VALUE){
+ pkt.dts += duration;

ifile->last_ts = av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q);

+ }

if (debug_ts) {

av_log(NULL, AV_LOG_INFO, "demuxer+ffmpeg -> ist_index:%d type:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%s off_time:%s\n",

Last edited 7 years ago by krs_vital (previous) (diff)

by krs_vital, 7 years ago

Attachment: ffmpeg.c added

comment:13 by krs_vital, 7 years ago

check this ffmpeg.c file please

comment:14 by krs_vital, 7 years ago

after many tests my ffmpeg.c file is wrong, but i found a sulution:

/usr/local/bin/ffmpeg -dts_delta_threshold 120000000 -dts_error_threshold 120000000 -buffer_size 8388608 -pkt_size 1316 -fifo_size 80000 -overrun_nonfatal 1 -copytb 1 -i udp://239.192.3.123:1234 -sn -dn -c copy -hls_allow_cache 0 -hls_ts_options mpegts_flags=+system_b -hls_base_url /ts/Fuel_HD/ -hls_list_size 5 -hls_time 5 -hls_flags delete_segments+omit_endlist -map 0 -ignore_unknown -strict -2 -use_localtime 1 -max_interleave_delta 120000000 -hls_segment_filename /hls/ts/Fuel_HD/stream_%s.ts /hls/pl/Fuel_HD.m3u8

input params:
dts_delta_threshold - 120 sec
dts_error_threshold = 120 sec

output params for muxer:
max_interleave_delta 120 sec

when all of stream scrambling or one of sound or video tracks disapears or scrambling for 10 seconds and more and after then restored (not scrambled or sound or video track in the stream apears again) and if dts_delta_threshold = 10 sec (by default) and muxer option max_interleave_delta = 10 sec (by default) then muxer do force output and this behavior leads to 2 problems:

  1. memory leak of ffmpeg from mux.c
  2. loss or lag in sound

im create a new ticket: https://trac.ffmpeg.org/ticket/6623

comment:15 by krs_vital, 7 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.