Using ffmpeg with youtube-dl: Non-monotonous DTS in output stream

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Using ffmpeg with youtube-dl: Non-monotonous DTS in output stream

Tefl Zuren
I'm trying to download a video with youtube-dl (http://rg3.github.io/youtube-dl/). It uses ffmpeg. At the beginning of the second group of mpegts files, ffmpeg starts throwing the error "Non-monotonous DTS in output stream 0:0; ... This may result in incorrect timestamps in the output file." and continues for the remainder of the download. The saved mp4 file is only playable up to 20:26 then it freezes. This problem usually occurs only on the TNT and TBS websites. The output is:

youtube-dl https://www.tntdrama.com/movies/a-christmas-story
[TBS] a-christmas-story: Downloading webpage
[TBS] 4b2d9001ea25d41c9ff0d15c6c9f899af96d333f: Downloading JSON metadata
[TBS] 4b2d9001ea25d41c9ff0d15c6c9f899af96d333f: Retrieving Media Token
[TBS] 4b2d9001ea25d41c9ff0d15c6c9f899af96d333f: Downloading XML
[TBS] 4b2d9001ea25d41c9ff0d15c6c9f899af96d333f: Downloading m3u8 information
[download] Destination: A Christmas Story.mp4
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 4.8 (SUSE Linux)
  configuration: --enable-openssl
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
[hls,applehttp @ 0x23c7900] Opening 'https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg.key' for reading
[hls,applehttp @ 0x23c7900] Opening 'crypto+https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg-0_00000.ts' for reading
Input #0, hls,applehttp, from 'https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/layer7_bk.m3u8?hdntl=exp=1544853868~acl=%2ftnt%2f83b278d50b415d38d9d85e6584e23004%2f*~hmac=421213acd762b1be021249cc78935d1141e301a3b8f31e73318c0131dc384093':
  Duration: 01:29:01.24, start: 1.466733, bitrate: 0 kb/s
  Program 0
    Metadata:
      variant_bitrate : 0
    Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Metadata:
      variant_bitrate : 0
    Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp
    Metadata:
      variant_bitrate : 0
Output #0, mp4, to 'file:A Christmas Story.mp4.part':
  Metadata:
    encoder         : Lavf58.20.100
    Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 29.97 tbr, 90k tbn, 90k tbc
    Metadata:
      variant_bitrate : 0
    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp
    Metadata:
      variant_bitrate : 0
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[hls,applehttp @ 0x23c7900] Opening 'crypto+https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg-0_00001.ts' for reading
...
[hls,applehttp @ 0x23c7900] Opening 'crypto+https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg-0_00204.ts' for reading
[hls,applehttp @ 0x23c7900] Opening 'crypto+https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg-1_00000.ts' for reading
[mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous: 110426426, current: -6006; changing to 110426427. This may result in incorrect timestamps in the output file.
[mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous: 110426427, current: -3003; changing to 110426428. This may result in incorrect timestamps in the output file.
[mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous: 110426428, current: 0; changing to 110426429. This may result in incorrect timestamps in the output file.
[mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous: 110426429, current: 3003; changing to 110426430. This may result in incorrect timestamps in the output file.
[mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous: 110426430, current: 6006; changing to 110426431. This may result in incorrect timestamps in the output file.
...

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Using ffmpeg with youtube-dl: Non-monotonous DTS in output stream

Gyan

On 15-12-2018 07:15 AM, Tefl Zuren wrote:

> I'm trying to download a video with youtube-dl (http://rg3.github.io/youtube-dl/). It uses ffmpeg. At the beginning of the second group of mpegts files, ffmpeg starts throwing the error "Non-monotonous DTS in output stream 0:0; ... This may result in incorrect timestamps in the output file." and continues for the remainder of the download. The saved mp4 file is only playable up to 20:26 then it freezes. This problem usually occurs only on the TNT and TBS websites. The output is:
> [hls,applehttp @ 0x23c7900] Opening 'https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg.key' for reading
> [hls,applehttp @ 0x23c7900] Opening 'crypto+https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg-0_00000.ts' for reading
> Input #0, hls,applehttp, from 'https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/layer7_bk.m3u8?hdntl=exp=1544853868~acl=%2ftnt%2f83b278d50b415d38d9d85e6584e23004%2f*~hmac=421213acd762b1be021249cc78935d1141e301a3b8f31e73318c0131dc384093':
>    Duration: 01:29:01.24, start: 1.466733, bitrate: 0 kb/s
>    Program 0
>      Metadata:
>        variant_bitrate : 0
>      Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
>      Metadata:
>        variant_bitrate : 0
>      Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp
>      Metadata:
>        variant_bitrate : 0

> [hls,applehttp @ 0x23c7900] Opening 'crypto+https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg-0_00001.ts' for reading
> ...
> [hls,applehttp @ 0x23c7900] Opening 'crypto+https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg-0_00204.ts' for reading
> [hls,applehttp @ 0x23c7900] Opening 'crypto+https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg-1_00000.ts' for reading
> [mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous: 110426426, current: -6006; changing to 110426427. This may result in incorrect timestamps in the output file.
> [mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous: 110426427, current: -3003; changing to 110426428. This may result in incorrect timestamps in the output file.
> [mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous: 110426428, current: 0; changing to 110426429. This may result in incorrect timestamps in the output file.
> [mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous: 110426429, current: 3003; changing to 110426430. This may result in incorrect timestamps in the output file.
> [mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous: 110426430, current: 6006; changing to 110426431. This may result in incorrect timestamps in the output file.

Some playlists contain a sequence of separately produced MPEG-TS files.
So, there's a timestamp reset when each new segment is received. At this
point, the timestamp code in libavformat's mux.c simply increments the
output timestamp by one when this happens. Unless the timebase
resolution is 1/fps, this produces an unsound file. Workaround is to
extract the individual streams and remux using mp4box.

     ffmpeg -i downloaded.mp4 -c copy video.h264

     ffmpeg -i downloaded.mp4 -c copy audio.aac

     mp4box -add video.h264 -add audio.aac -new fixed.mp4


Gyan

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Using ffmpeg with youtube-dl: Non-monotonous DTS in output stream

Moritz Barsnick
In reply to this post by Tefl Zuren
On Sat, Dec 15, 2018 at 01:45:44 +0000, Tefl Zuren wrote:
> youtube-dl https://www.tntdrama.com/movies/a-christmas-story

Unfortunately, probably for geographical reasons, I can't access that
video.

> [TBS] 4b2d9001ea25d41c9ff0d15c6c9f899af96d333f: Downloading m3u8 information
> [download] Destination: A Christmas Story.mp4

This this is an MPEG-TS m3u8, can you try downloading the raw file?

$ youtube-dl --hls-prefer-native --hls-use-mpegts --no-part --fixup never https://www.tntdrama.com/movies/a-christmas-story

This *should* grab the original MPEG-TS segments and only reassemble
them by concatenation, without remuxing.

(youtube-dl will give the file the suffix .mp4, but it's actually an
MPEG-TS.)

Then see if you can play that file successfully beyond the 20:26 point.

OTOH, remuxing that file with ffmpeg should show the same issues as you
reported. Gyan's suggestion may help.

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Using ffmpeg with youtube-dl: Non-monotonous DTS in output stream

Paul B Mahol
In reply to this post by Gyan
On 12/15/18, Gyan <[hidden email]> wrote:

>
> On 15-12-2018 07:15 AM, Tefl Zuren wrote:
>> I'm trying to download a video with youtube-dl
>> (http://rg3.github.io/youtube-dl/). It uses ffmpeg. At the beginning of
>> the second group of mpegts files, ffmpeg starts throwing the error
>> "Non-monotonous DTS in output stream 0:0; ... This may result in incorrect
>> timestamps in the output file." and continues for the remainder of the
>> download. The saved mp4 file is only playable up to 20:26 then it freezes.
>> This problem usually occurs only on the TNT and TBS websites. The output
>> is:
>> [hls,applehttp @ 0x23c7900] Opening
>> 'https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg.key'
>> for reading
>> [hls,applehttp @ 0x23c7900] Opening
>> 'crypto+https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg-0_00000.ts'
>> for reading
>> Input #0, hls,applehttp, from
>> 'https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/layer7_bk.m3u8?hdntl=exp=1544853868~acl=%2ftnt%2f83b278d50b415d38d9d85e6584e23004%2f*~hmac=421213acd762b1be021249cc78935d1141e301a3b8f31e73318c0131dc384093':
>>    Duration: 01:29:01.24, start: 1.466733, bitrate: 0 kb/s
>>    Program 0
>>      Metadata:
>>        variant_bitrate : 0
>>      Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p,
>> 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 29.97 fps, 29.97 tbr, 90k
>> tbn, 59.94 tbc
>>      Metadata:
>>        variant_bitrate : 0
>>      Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz,
>> stereo, fltp
>>      Metadata:
>>        variant_bitrate : 0
>
>> [hls,applehttp @ 0x23c7900] Opening
>> 'crypto+https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg-0_00001.ts'
>> for reading
>> ...
>> [hls,applehttp @ 0x23c7900] Opening
>> 'crypto+https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg-0_00204.ts'
>> for reading
>> [hls,applehttp @ 0x23c7900] Opening
>> 'crypto+https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg-1_00000.ts'
>> for reading
>> [mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous:
>> 110426426, current: -6006; changing to 110426427. This may result in
>> incorrect timestamps in the output file.
>> [mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous:
>> 110426427, current: -3003; changing to 110426428. This may result in
>> incorrect timestamps in the output file.
>> [mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous:
>> 110426428, current: 0; changing to 110426429. This may result in incorrect
>> timestamps in the output file.
>> [mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous:
>> 110426429, current: 3003; changing to 110426430. This may result in
>> incorrect timestamps in the output file.
>> [mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous:
>> 110426430, current: 6006; changing to 110426431. This may result in
>> incorrect timestamps in the output file.
>
> Some playlists contain a sequence of separately produced MPEG-TS files.
> So, there's a timestamp reset when each new segment is received. At this
> point, the timestamp code in libavformat's mux.c simply increments the
> output timestamp by one when this happens. Unless the timebase
> resolution is 1/fps, this produces an unsound file. Workaround is to
> extract the individual streams and remux using mp4box.
>
>      ffmpeg -i downloaded.mp4 -c copy video.h264
>
>      ffmpeg -i downloaded.mp4 -c copy audio.aac
>
>      mp4box -add video.h264 -add audio.aac -new fixed.mp4

Can't ffmpeg be used in last step too?
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Using ffmpeg with youtube-dl: Non-monotonous DTS in output stream

Gyan

On 15-12-2018 07:44 PM, Paul B Mahol wrote:

> On 12/15/18, Gyan <[hidden email]> wrote:
>> Some playlists contain a sequence of separately produced MPEG-TS files.
>> So, there's a timestamp reset when each new segment is received. At this
>> point, the timestamp code in libavformat's mux.c simply increments the
>> output timestamp by one when this happens. Unless the timebase
>> resolution is 1/fps, this produces an unsound file. Workaround is to
>> extract the individual streams and remux using mp4box.
>>
>>       ffmpeg -i downloaded.mp4 -c copy video.h264
>>
>>       ffmpeg -i downloaded.mp4 -c copy audio.aac
>>
>>       mp4box -add video.h264 -add audio.aac -new fixed.mp4
> Can't ffmpeg be used in last step too?

I avoid it due to PTS generation bug for H264 streams with B-frames,
specifically hierarchical B-frames.

Gyan

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Using ffmpeg with youtube-dl: Non-monotonous DTS in output stream

Tefl Zuren
In reply to this post by Moritz Barsnick
youtube-dl still uses ffmpeg with the options you suggested: WARNING: hlsnative has detected features it does not support, extraction will be delegated to ffmpeg
so it yields the same result
________________________________
From: ffmpeg-user <[hidden email]> on behalf of Moritz Barsnick <[hidden email]>
Sent: Saturday, December 15, 2018 8:49 AM
To: FFmpeg user discussions
Subject: Re: [FFmpeg-user] Using ffmpeg with youtube-dl: Non-monotonous DTS in output stream

On Sat, Dec 15, 2018 at 01:45:44 +0000, Tefl Zuren wrote:
> youtube-dl https://www.tntdrama.com/movies/a-christmas-story

Unfortunately, probably for geographical reasons, I can't access that
video.

> [TBS] 4b2d9001ea25d41c9ff0d15c6c9f899af96d333f: Downloading m3u8 information
> [download] Destination: A Christmas Story.mp4

This this is an MPEG-TS m3u8, can you try downloading the raw file?

$ youtube-dl --hls-prefer-native --hls-use-mpegts --no-part --fixup never https://www.tntdrama.com/movies/a-christmas-story

This *should* grab the original MPEG-TS segments and only reassemble
them by concatenation, without remuxing.

(youtube-dl will give the file the suffix .mp4, but it's actually an
MPEG-TS.)

Then see if you can play that file successfully beyond the 20:26 point.

OTOH, remuxing that file with ffmpeg should show the same issues as you
reported. Gyan's suggestion may help.

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Using ffmpeg with youtube-dl: Non-monotonous DTS in output stream

Tefl Zuren
In reply to this post by Gyan
Not an optimal solution, but it works. Thanks.
Could this be a feature request in ffmpeg or libavformat to have it handle concatenating multiple mpegts segments correctly when their timestamps aren't continuous?

________________________________
From: ffmpeg-user <[hidden email]> on behalf of Gyan <[hidden email]>
Sent: Friday, December 14, 2018 11:47 PM
To: [hidden email]
Subject: Re: [FFmpeg-user] Using ffmpeg with youtube-dl: Non-monotonous DTS in output stream


On 15-12-2018 07:15 AM, Tefl Zuren wrote:

> I'm trying to download a video with youtube-dl (http://rg3.github.io/youtube-dl/). It uses ffmpeg. At the beginning of the second group of mpegts files, ffmpeg starts throwing the error "Non-monotonous DTS in output stream 0:0; ... This may result in incorrect timestamps in the output file." and continues for the remainder of the download. The saved mp4 file is only playable up to 20:26 then it freezes. This problem usually occurs only on the TNT and TBS websites. The output is:
> [hls,applehttp @ 0x23c7900] Opening 'https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg.key' for reading
> [hls,applehttp @ 0x23c7900] Opening 'crypto+https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg-0_00000.ts' for reading
> Input #0, hls,applehttp, from 'https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/layer7_bk.m3u8?hdntl=exp=1544853868~acl=%2ftnt%2f83b278d50b415d38d9d85e6584e23004%2f*~hmac=421213acd762b1be021249cc78935d1141e301a3b8f31e73318c0131dc384093':
>    Duration: 01:29:01.24, start: 1.466733, bitrate: 0 kb/s
>    Program 0
>      Metadata:
>        variant_bitrate : 0
>      Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
>      Metadata:
>        variant_bitrate : 0
>      Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp
>      Metadata:
>        variant_bitrate : 0

> [hls,applehttp @ 0x23c7900] Opening 'crypto+https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg-0_00001.ts' for reading
> ...
> [hls,applehttp @ 0x23c7900] Opening 'crypto+https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg-0_00204.ts' for reading
> [hls,applehttp @ 0x23c7900] Opening 'crypto+https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg-1_00000.ts' for reading
> [mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous: 110426426, current: -6006; changing to 110426427. This may result in incorrect timestamps in the output file.
> [mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous: 110426427, current: -3003; changing to 110426428. This may result in incorrect timestamps in the output file.
> [mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous: 110426428, current: 0; changing to 110426429. This may result in incorrect timestamps in the output file.
> [mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous: 110426429, current: 3003; changing to 110426430. This may result in incorrect timestamps in the output file.
> [mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous: 110426430, current: 6006; changing to 110426431. This may result in incorrect timestamps in the output file.

Some playlists contain a sequence of separately produced MPEG-TS files.
So, there's a timestamp reset when each new segment is received. At this
point, the timestamp code in libavformat's mux.c simply increments the
output timestamp by one when this happens. Unless the timebase
resolution is 1/fps, this produces an unsound file. Workaround is to
extract the individual streams and remux using mp4box.

     ffmpeg -i downloaded.mp4 -c copy video.h264

     ffmpeg -i downloaded.mp4 -c copy audio.aac

     mp4box -add video.h264 -add audio.aac -new fixed.mp4


Gyan

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Using ffmpeg with youtube-dl: Non-monotonous DTS in output stream

Tefl Zuren
I've downloaded and applied this workaround to two movies. I haven't watched either from beginning to end, but I did preview them. When skipping forward through either movie, around ¾ of the way through the picture turns solid gray except for some colored pixels at the top that continuously change.

________________________________
From: ffmpeg-user <[hidden email]> on behalf of Tefl Zuren <[hidden email]>
Sent: Saturday, December 15, 2018 6:08 PM
To: FFmpeg user questions
Subject: Re: [FFmpeg-user] Using ffmpeg with youtube-dl: Non-monotonous DTS in output stream

Not an optimal solution, but it works. Thanks.
Could this be a feature request in ffmpeg or libavformat to have it handle concatenating multiple mpegts segments correctly when their timestamps aren't continuous?

________________________________
From: ffmpeg-user <[hidden email]> on behalf of Gyan <[hidden email]>
Sent: Friday, December 14, 2018 11:47 PM
To: [hidden email]
Subject: Re: [FFmpeg-user] Using ffmpeg with youtube-dl: Non-monotonous DTS in output stream


On 15-12-2018 07:15 AM, Tefl Zuren wrote:

> I'm trying to download a video with youtube-dl (http://rg3.github.io/youtube-dl/). It uses ffmpeg. At the beginning of the second group of mpegts files, ffmpeg starts throwing the error "Non-monotonous DTS in output stream 0:0; ... This may result in incorrect timestamps in the output file." and continues for the remainder of the download. The saved mp4 file is only playable up to 20:26 then it freezes. This problem usually occurs only on the TNT and TBS websites. The output is:
> [hls,applehttp @ 0x23c7900] Opening 'https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg.key' for reading
> [hls,applehttp @ 0x23c7900] Opening 'crypto+https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg-0_00000.ts' for reading
> Input #0, hls,applehttp, from 'https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/layer7_bk.m3u8?hdntl=exp=1544853868~acl=%2ftnt%2f83b278d50b415d38d9d85e6584e23004%2f*~hmac=421213acd762b1be021249cc78935d1141e301a3b8f31e73318c0131dc384093':
>    Duration: 01:29:01.24, start: 1.466733, bitrate: 0 kb/s
>    Program 0
>      Metadata:
>        variant_bitrate : 0
>      Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
>      Metadata:
>        variant_bitrate : 0
>      Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp
>      Metadata:
>        variant_bitrate : 0

> [hls,applehttp @ 0x23c7900] Opening 'crypto+https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg-0_00001.ts' for reading
> ...
> [hls,applehttp @ 0x23c7900] Opening 'crypto+https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg-0_00204.ts' for reading
> [hls,applehttp @ 0x23c7900] Opening 'crypto+https://tve.cdn.turner.com/tnt/83b278d50b415d38d9d85e6584e23004/layer7/seg-1_00000.ts' for reading
> [mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous: 110426426, current: -6006; changing to 110426427. This may result in incorrect timestamps in the output file.
> [mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous: 110426427, current: -3003; changing to 110426428. This may result in incorrect timestamps in the output file.
> [mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous: 110426428, current: 0; changing to 110426429. This may result in incorrect timestamps in the output file.
> [mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous: 110426429, current: 3003; changing to 110426430. This may result in incorrect timestamps in the output file.
> [mp4 @ 0x2479700] Non-monotonous DTS in output stream 0:0; previous: 110426430, current: 6006; changing to 110426431. This may result in incorrect timestamps in the output file.

Some playlists contain a sequence of separately produced MPEG-TS files.
So, there's a timestamp reset when each new segment is received. At this
point, the timestamp code in libavformat's mux.c simply increments the
output timestamp by one when this happens. Unless the timebase
resolution is 1/fps, this produces an unsound file. Workaround is to
extract the individual streams and remux using mp4box.

     ffmpeg -i downloaded.mp4 -c copy video.h264

     ffmpeg -i downloaded.mp4 -c copy audio.aac

     mp4box -add video.h264 -add audio.aac -new fixed.mp4


Gyan

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".