Opened 8 years ago

Closed 4 years ago

#5525 closed defect (worksforme)

hls_ts_options not applied to all ts packets

Reported by: jack Owned by:
Priority: normal Component: avformat
Version: unspecified Keywords: hls ts options
Cc: Michael Niedermayer Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

  • What I am trying to do:

Create an HLS stream that is DVB compatible (mpegts's option system_b seems to do the job), the default hls stream is not compatible

  • What is my issue:

Using the above option (through -hls_ts_options) works for the first mpegts file. However, this option is not applied for all others files.

  • The cmd line I use:
    $ ffmpeg -nostats -i udp://@233.97.72.12:1234 -hls_ts_options mpegts_flags=system_b -map 0:v -map 0:a -c copy -threads 4 -hls_time 10 -hls_flags delete_segments -hls_base_url http://10.1.1.2/testing/ /data/testing/play.m3u8
    ffmpeg version 3.0.2-1 Copyright (c) 2000-2016 the FFmpeg developers
      built with gcc 5.3.1 (Debian 5.3.1-17) 20160429
      configuration: --prefix=/usr --extra-version=1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librubberband --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-chromaprint --enable-libx264
      libavutil      55. 17.103 / 55. 17.103
      libavcodec     57. 24.102 / 57. 24.102
      libavformat    57. 25.100 / 57. 25.100
      libavdevice    57.  0.101 / 57.  0.101
      libavfilter     6. 31.100 /  6. 31.100
      libavresample   3.  0.  0 /  3.  0.  0
      libswscale      4.  0.100 /  4.  0.100
      libswresample   2.  0.101 /  2.  0.101
      libpostproc    54.  0.100 / 54.  0.100
    [h264 @ 0x1c995e0] non-existing PPS 0 referenced
        Last message repeated 1 times
    [h264 @ 0x1c995e0] decode_slice_header error
    [h264 @ 0x1c995e0] no frame!
    [h264 @ 0x1c995e0] non-existing PPS 0 referenced
        Last message repeated 2 times
    [h264 @ 0x1c995e0] decode_slice_header error
    [h264 @ 0x1c995e0] no frame!
    [h264 @ 0x1c995e0] non-existing PPS 0 referenced
    [h264 @ 0x1c995e0] decode_slice_header error
    [h264 @ 0x1c995e0] no frame!
    [h264 @ 0x1c995e0] non-existing PPS 0 referenced
        Last message repeated 2 times
    [h264 @ 0x1c995e0] decode_slice_header error
    [h264 @ 0x1c995e0] no frame!
    [h264 @ 0x1c995e0] non-existing PPS 0 referenced
    [h264 @ 0x1c995e0] decode_slice_header error
    [h264 @ 0x1c995e0] no frame!
    [h264 @ 0x1c995e0] non-existing PPS 0 referenced
        Last message repeated 2 times
    [h264 @ 0x1c995e0] decode_slice_header error
    [h264 @ 0x1c995e0] no frame!
    [h264 @ 0x1c995e0] non-existing PPS 0 referenced
    [h264 @ 0x1c995e0] decode_slice_header error
    [h264 @ 0x1c995e0] no frame!
    [h264 @ 0x1c995e0] non-existing PPS 0 referenced
        Last message repeated 2 times
    [h264 @ 0x1c995e0] decode_slice_header error
    [h264 @ 0x1c995e0] no frame!
    [h264 @ 0x1c995e0] non-existing PPS 0 referenced
    [h264 @ 0x1c995e0] decode_slice_header error
    [h264 @ 0x1c995e0] no frame!
    [h264 @ 0x1c995e0] non-existing PPS 0 referenced
        Last message repeated 2 times
    [h264 @ 0x1c995e0] decode_slice_header error
    [h264 @ 0x1c995e0] no frame!
    [h264 @ 0x1c995e0] non-existing PPS 0 referenced
    [h264 @ 0x1c995e0] decode_slice_header error
    [h264 @ 0x1c995e0] no frame!
    [h264 @ 0x1c995e0] non-existing PPS 0 referenced
        Last message repeated 2 times
    [h264 @ 0x1c995e0] decode_slice_header error
    [h264 @ 0x1c995e0] no frame!
    [h264 @ 0x1c995e0] non-existing PPS 0 referenced
    [h264 @ 0x1c995e0] decode_slice_header error
    [h264 @ 0x1c995e0] no frame!
    [h264 @ 0x1c995e0] non-existing PPS 0 referenced
        Last message repeated 2 times
    [h264 @ 0x1c995e0] decode_slice_header error
    [h264 @ 0x1c995e0] no frame!
    [h264 @ 0x1c995e0] non-existing PPS 0 referenced
    [h264 @ 0x1c995e0] decode_slice_header error
    [h264 @ 0x1c995e0] no frame!
    [h264 @ 0x1c995e0] non-existing PPS 0 referenced
        Last message repeated 2 times
    [h264 @ 0x1c995e0] decode_slice_header error
    [h264 @ 0x1c995e0] no frame!
    [h264 @ 0x1c995e0] non-existing PPS 0 referenced
    [h264 @ 0x1c995e0] decode_slice_header error
    [h264 @ 0x1c995e0] no frame!
    [h264 @ 0x1c995e0] non-existing PPS 0 referenced
        Last message repeated 2 times
    [h264 @ 0x1c995e0] decode_slice_header error
    [h264 @ 0x1c995e0] no frame!
    [h264 @ 0x1c995e0] non-existing PPS 0 referenced
    [h264 @ 0x1c995e0] decode_slice_header error
    [h264 @ 0x1c995e0] no frame!
    [h264 @ 0x1c995e0] non-existing PPS 0 referenced
        Last message repeated 2 times
    [h264 @ 0x1c995e0] decode_slice_header error
    [h264 @ 0x1c995e0] no frame!
    [h264 @ 0x1c995e0] non-existing PPS 0 referenced
    [h264 @ 0x1c995e0] decode_slice_header error
    [h264 @ 0x1c995e0] no frame!
    [h264 @ 0x1c995e0] non-existing PPS 0 referenced
        Last message repeated 1 times
    [h264 @ 0x1c995e0] decode_slice_header error
    [h264 @ 0x1c995e0] no frame!
    [h264 @ 0x1c995e0] mmco: unref short failure
        Last message repeated 2 times
    [h264 @ 0x1c995e0] Increasing reorder buffer to 2
    [h264 @ 0x1c995e0] Increasing reorder buffer to 3
    [h264 @ 0x1c995e0] mmco: unref short failure
        Last message repeated 1 times
    [h264 @ 0x1c995e0] number of reference frames (0+5) exceeds max (4; probably corrupt input), discarding one
    [mpegts @ 0x1c74ca0] Could not find codec parameters for stream 6 (Unknown: none ([5][0][0][0] / 0x0005)): unknown codec
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
    [mpegts @ 0x1c74ca0] Could not find codec parameters for stream 7 (Unknown: none ([11][0][0][0] / 0x000B)): unknown codec
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
    Input #0, mpegts, from 'udp://@233.97.72.12:1234':
      Duration: N/A, start: 28480.957233, bitrate: N/A
      Program 2001 
        Metadata:
          service_name    : NRJ12
          service_provider: TCOAX
        Stream #0:0[0x42]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 24.83 fps, 25 tbr, 90k tbn, 50 tbc
        Stream #0:1[0x44](fra): Audio: eac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 128 kb/s
        Stream #0:2[0x45](qaa): Audio: eac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 128 kb/s
        Stream #0:3[0x46](qad): Audio: eac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 96 kb/s
        Stream #0:4[0x47](fra): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) (hearing impaired)
        Stream #0:5[0x48](fra): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
        Stream #0:6[0x49]: Unknown: none ([5][0][0][0] / 0x0005)
        Stream #0:7[0x4a]: Unknown: none ([11][0][0][0] / 0x000B)
    Output #0, hls, to '/data/testing/play.m3u8':
      Metadata:
        encoder         : Lavf57.25.100
        Stream #0:0: Video: h264 ([27][0][0][0] / 0x001B), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 24.83 fps, 25 tbr, 90k tbn, 25 tbc
        Stream #0:1(fra): Audio: eac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, 128 kb/s
        Stream #0:2(qaa): Audio: eac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, 128 kb/s
        Stream #0:3(qad): Audio: eac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, 96 kb/s
    Stream mapping:
      Stream #0:0 -> #0:0 (copy)
      Stream #0:1 -> #0:1 (copy)
      Stream #0:2 -> #0:2 (copy)
      Stream #0:3 -> #0:3 (copy)
    Press [q] to stop, [?] for help
    [hls @ 0x1ca3540] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
    [hls @ 0x1ca3540] Non-monotonous DTS in output stream 0:0; previous: 93484, current: 93484; changing to 93485. This may result in incorrect timestamps in the output file.
    [mpegts @ 0x1e8bdc0] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
    frame=  582 fps= 34 q=-1.0 Lsize=N/A time=00:00:22.75 bitrate=N/A speed=1.33x    
    video:9430kB audio:948kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
    Exiting normally, received signal 2.
    

There is a tsinfo of the first file (play0.ts), which is OK:

$ tsinfo play0.ts 
Reading from play0.ts
Scanning 1000 TS packets

Packet 2 is PAT
Program list:
    Program 1 -> PID 1000 (4096)

Packet 3 is PMT with PID 1000 (4096)
  Program 1, version 0, PCR PID 0100 (256)
  Program streams:
    PID 0100 ( 256) -> Stream type 1b ( 27) H.264/14496-10 video (MPEG-4/AVC)
    PID 0101 ( 257) -> Stream type 06 (  6) H.222.0/13818-1 PES private data (maybe Dolby/AC-3 in DVB)
        ES info (3 bytes): 7a 01 00
        Descriptor tag 7a (122) (1 byte): 00
    PID 0102 ( 258) -> Stream type 06 (  6) H.222.0/13818-1 PES private data (maybe Dolby/AC-3 in DVB)
        ES info (3 bytes): 7a 01 00
        Descriptor tag 7a (122) (1 byte): 00
    PID 0103 ( 259) -> Stream type 06 (  6) H.222.0/13818-1 PES private data (maybe Dolby/AC-3 in DVB)
        ES info (3 bytes): 7a 01 00
        Descriptor tag 7a (122) (1 byte): 00

Found 4 PAT packets and 2 PMT packets in 1000 TS packets

And this is the tsinfo for file #2, which is not OK (play1.ts):

tsinfo play1.ts 
Reading from play1.ts
Scanning 1000 TS packets

Packet 2 is PAT
Program list:
    Program 1 -> PID 1000 (4096)

Packet 3 is PMT with PID 1000 (4096)
  Program 1, version 0, PCR PID 0100 (256)
  Program streams:
    PID 0100 ( 256) -> Stream type 1b ( 27) H.264/14496-10 video (MPEG-4/AVC)
    PID 0101 ( 257) -> Stream type 87 (135) User private
    PID 0102 ( 258) -> Stream type 87 (135) User private
    PID 0103 ( 259) -> Stream type 87 (135) User private

Found 2 PAT packets and 1 PMT packet in 1000 TS packets

Unless I'm mistaken, the option is only used in hls_write_header (from libavformat/hlsenc.c), which is only called once

Thank you for ffmpeg!

Change History (4)

comment:1 by Michael Niedermayer, 8 years ago

Can you provide a testcase that doesnt use remote protcols?
that is one using files so the testcase can be run locally

comment:2 by Michael Niedermayer, 8 years ago

Cc: Michael Niedermayer added

comment:3 by jack, 8 years ago

Sure, any input seems to reproduce, at long as it contains atn eac3 audio stream

2% [jack:/tmp]./ffmpeg -i test.mkv 
ffmpeg version git-2016-05-14-81c3ce0 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.1 (Debian 5.3.1-11) 20160307
  configuration: --disable-vaapi
  libavutil      55. 24.100 / 55. 24.100
  libavcodec     57. 42.100 / 57. 42.100
  libavformat    57. 36.100 / 57. 36.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 45.100 /  6. 45.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
Input #0, matroska,webm, from 'test.mkv':
  Metadata:
    ENCODER         : Lavf57.25.100
  Duration: 00:21:00.25, start: 0.000000, bitrate: 1184 kb/s
    Stream #0:0: Video: mpeg4 (Simple Profile), yuv420p, 720x404 [SAR 1:1 DAR 180:101], 23.98 fps, 23.98 tbr, 1k tbn (default)
    Metadata:
      DURATION        : 00:21:00.100000000
    Stream #0:1: Audio: eac3, 44100 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      ENCODER         : Lavc57.24.102 eac3
      DURATION        : 00:21:00.252000000
At least one output file must be specified
3% [jack:/tmp]./ffmpeg -nostats -i test.mkv -hls_ts_options mpegts_flags=system_b -map 0:v -map 0:a -c copy -threads 4 -hls_time 10 -hls_base_url http://10.1.1.2/test/ /tmp/test/play.m3u8
ffmpeg version git-2016-05-14-81c3ce0 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.1 (Debian 5.3.1-11) 20160307
  configuration: --disable-vaapi
  libavutil      55. 24.100 / 55. 24.100
  libavcodec     57. 42.100 / 57. 42.100
  libavformat    57. 36.100 / 57. 36.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 45.100 /  6. 45.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
Input #0, matroska,webm, from 'test.mkv':
  Metadata:
    ENCODER         : Lavf57.25.100
  Duration: 00:21:00.25, start: 0.000000, bitrate: 1184 kb/s
    Stream #0:0: Video: mpeg4 (Simple Profile), yuv420p, 720x404 [SAR 1:1 DAR 180:101], 23.98 fps, 23.98 tbr, 1k tbn (default)
    Metadata:
      DURATION        : 00:21:00.100000000
    Stream #0:1: Audio: eac3, 44100 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      ENCODER         : Lavc57.24.102 eac3
      DURATION        : 00:21:00.252000000
[hls @ 0x3c1f9e0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, hls, to '/tmp/test/play.m3u8':
  Metadata:
    encoder         : Lavf57.36.100
    Stream #0:0: Video: mpeg4, yuv420p, 720x404 [SAR 1:1 DAR 180:101], q=2-31, 23.98 fps, 23.98 tbr, 90k tbn (default)
    Metadata:
      DURATION        : 00:21:00.100000000
    Stream #0:1: Audio: eac3, 44100 Hz, stereo, 192 kb/s (default)
    Metadata:
      ENCODER         : Lavc57.24.102 eac3
      DURATION        : 00:21:00.252000000
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=30212 fps=6774 q=-1.0 Lsize=N/A time=00:21:00.21 bitrate=N/A speed= 283x    
video:152138kB audio:29537kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
4% [jack:/tmp]tsinfo test/play0.ts 
Reading from test/play0.ts
Scanning 1000 TS packets

Packet 2 is PAT
Program list:
    Program 1 -> PID 1000 (4096)

Packet 3 is PMT with PID 1000 (4096)
  Program 1, version 0, PCR PID 0100 (256)
  Program streams:
    PID 0100 ( 256) -> Stream type 10 ( 16) 14496-2 Visual (MPEG-4 part 2 video)
    PID 0101 ( 257) -> Stream type 06 (  6) H.222.0/13818-1 PES private data (maybe Dolby/AC-3 in DVB)
        ES info (3 bytes): 7a 01 00
        Descriptor tag 7a (122) (1 byte): 00

Found 2 PAT packets and 1 PMT packet in 1000 TS packets
3% [jack:/tmp]tsinfo test/play2.ts 
Reading from test/play2.ts
Scanning 1000 TS packets

Packet 2 is PAT
Program list:
    Program 1 -> PID 1000 (4096)

Packet 3 is PMT with PID 1000 (4096)
  Program 1, version 0, PCR PID 0100 (256)
  Program streams:
    PID 0100 ( 256) -> Stream type 10 ( 16) 14496-2 Visual (MPEG-4 part 2 video)
    PID 0101 ( 257) -> Stream type 87 (135) User private

Found 2 PAT packets and 1 PMT packet in 1000 TS packets

I removed -hls_flags delete_segments only to get the first segment easily, this option do not change anything from this case

comment:4 by Steven Liu, 4 years ago

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