Discussion:
[FFmpeg-user] How to hls without DTS error
Hisli Termos
2018-10-17 17:46:42 UTC
Permalink
Hello,
Objective: Hls stream (without transcode) of media files inside a directory
OS: Ubuntu 18.04 bionic
FFmpeg version:
[CODE]ffmpeg version N-92190-gb2adc31 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-27ubuntu1~18.04)
configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/root/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-vaapi --enable-libx264 --enable-libx265 --enable-nonfree
[/CODE]
Input: Multiple mp4 files with different dar,sar values
Output: Http - HLS
Codecs: Copy (video,audio,data)
Problem: When first video is come to an end, stream stops due to position of I frame etc.
I do not wish to choose transcode commands as it's cpu and time consuming process.
Would you please let me know what you recommend? May I accomplish this in ffmpeg?

Thanks
Ermos
_______________________________________________
ffmpeg-user mailing list
ffmpeg-***@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-***@ffmpeg.org with subject "unsub
Carl Eugen Hoyos
2018-10-17 18:23:20 UTC
Permalink
This post might be inappropriate. Click to display it.
Paul B Mahol
2018-10-17 18:25:39 UTC
Permalink
On 10/17/18, Carl Eugen Hoyos <***@gmail.com> wrote:
> 2018-10-17 19:46 GMT+02:00, Hisli Termos <***@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-***@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-***@ffmpeg.org wi
Hisli Termos
2018-10-17 21:38:26 UTC
Permalink
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-***@ffmpeg.org> on behalf of Paul B Mahol <***@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 <***@gmail.com> wrote:
> 2018-10-17 19:46 GMT+02:00, Hisli Termos <***@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-***@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-***@ffmpeg.org with subject "unsubscribe".
Loading...