[FFmpeg-user] How to hls without DTS error

Hisli Termos hislitermos at hotmail.com
Thu Oct 18 00:38:26 EEST 2018


Hello,
Just to be sure, I have tested two videos with same sar,dar but different resolution. Result is the same.
Here you are:

My Script:
#!/bin/bash
channel=test
cd /home/ermos/public_html/$channel
kill $(cat /home/ermos/public_html/$channel/*.pid)
for file in /home/ermos/public_html/$channel/*.mp4
 do name=`echo $i | cut -d'.' -f1`;
 echo $name;
 ionice -c3 nice -n 20 /root/bin/ffmpeg -loglevel info -hwaccel vdpau \
 -re -y \
 -i $file \
 -threads 0 \
 -map 0 \
 -movflags +faststart \
 -c:v copy -bsf:v h264_mp4toannexb -preset:v superfast -bufsize 6M \
 -c:a copy \
 -strict -2 \
 -f ssegment -hls_flags delete_segments -segment_list_size 3 -reset_timestamps 0 \
-segment_list playlist.m3u8  -segment_list_flags +live \
-segment_time 8 -hls_allow_cache 1  "out%05d.ts" &
 echo $! > "//home/ermos/public_html/$channel/1_`date +%Y%m%d_%H_%M_%S`.pid"
 wait $!;
 sleep 10;
 mv $file played_files/ ; rm playlist.m3u8
 done
 exit 0


First video file:
$ ffmpeg -hide_banner -i show.mp4
Output:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'show.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.83.100
  Duration: 00:00:58.42, start: 0.000000, bitrate: 998 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 899 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 93 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

Second video file:
$ ffmpeg -hide_banner -i zdua.mp4
Output:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'zdua.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.83.100
  Duration: 00:03:26.31, start: 0.000000, bitrate: 743 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709), 640x360 [SAR 1:1 DAR 16:9], 613 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
When I run myscript, even if both files have the same sar,dar but different resolution, I encounter the same problem. Please find attached output. (...as it is a bit long, I did not paste it here)

How to play:
First method: In Vlc, at the end of first video, it stopped.
Second method: In tvheadend system, I added url like (as I did many times for other stream formats regularly):
pipe:///home/ermos/public_html/test/playlist.m3u8
It accepted by the system, at the end of the first video, it stopped playing. When I restart playing, it started the second video. During this time, what I see on tvheadend console was below:


2018-10-17 22:51:42.463 TS: TEST/test.m3u - HLS: TEST1/Service01: H264 @ #256 Continuity counter error (total 1)
2018-10-17 22:51:42.463 TS: TEST/test.m3u - HLS: TEST1/Service01: AAC-LATM @ #257 Continuity counter error (total 1)
2018-10-17 22:52:06.468 TS: TEST/test.m3u - HLS: TEST1/Service01: H264 @ #256 Continuity counter error (total 2)
2018-10-17 22:52:06.468 TS: TEST/test.m3u - HLS: TEST1/Service01: AAC-LATM @ #257 Continuity counter error (total 2)
2018-10-17 22:52:46.477 TS: TEST/test.m3u - HLS: TEST1/Service01: H264 @ #256 Continuity counter error (total 4)
2018-10-17 22:52:49.476 TS: TEST/test.m3u - HLS: TEST1/Service01: AAC-LATM @ #257 Continuity counter error (total 4)
2018-10-17 22:53:01.481 TS: TEST/test.m3u - HLS: TEST1/Service01: H264 @ #256 Continuity counter error (total 6)
2018-10-17 22:53:03.479 TS: TEST/test.m3u - HLS: TEST1/Service01: AAC-LATM @ #257 Continuity counter error (total 6)
2018-10-17 22:53:16.484 TS: TEST/test.m3u - HLS: TEST1/Service01: AAC-LATM @ #257 Continuity counter error (total 8)
2018-10-17 22:53:25.484 TS: TEST/test.m3u - HLS: TEST1/Service01: H264 @ #256 Continuity counter error (total 8)

PS: This is my first question in this community. So, please kindly inform me if I am doing anything wrong while posting.

Thanks for your understanding
Ermos



________________________________
From: ffmpeg-user <ffmpeg-user-bounces at ffmpeg.org> on behalf of Paul B Mahol <onemda at gmail.com>
Sent: Wednesday, October 17, 2018 6:25 PM
To: FFmpeg user questions
Subject: Re: [FFmpeg-user] How to hls without DTS error

On 10/17/18, Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:
> 2018-10-17 19:46 GMT+02:00, Hisli Termos <hislitermos at hotmail.com>:
>
>> Input: Multiple mp4 files with different dar,sar values
>
> Please provide the command line you tested together with the
> complete, uncut console output.
>

Carl should also add that -hide_banner should not be used.
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mylog.txt
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20181017/546f70d1/attachment.txt>


More information about the ffmpeg-user mailing list