Tyrrrz/YoutubeExplode

Closed captions that contain invalid offsets and/or durations break when processing with FFmpeg

Tyrrrz opened this issue · 0 comments

Tyrrrz commented

Version

master

Platform

.NET 8

Steps to reproduce

var youtube = new YoutubeClient();

using var dir = TempDir.Create();
var filePath = Path.Combine(dir.Path, "video.mp4");

var streamManifest = await youtube.Videos.Streams.GetManifestAsync("dSu5sXmsur4");
var streamInfos = streamManifest
    .GetVideoStreams()
    .Where(s => s.Container == Container.Mp4)
    .OrderBy(s => s.Size)
    .Take(1)
    .ToArray();

var trackManifest = await youtube.Videos.ClosedCaptions.GetManifestAsync("dSu5sXmsur4");
var trackInfos = trackManifest.Tracks.Skip(10).Take(1).ToArray(); // Slovenian

// Act
await youtube
    .Videos
    .DownloadAsync(streamInfos, trackInfos, new ConversionRequestBuilder(filePath).Build());

Details

One of the captions contains duration that places it out of bounds in regard to the video duration:

image

Originally reported at Tyrrrz/YoutubeDownloader#405

Checklist

  • I have looked through existing issues to make sure that this bug has not been reported before
  • I have provided a descriptive title for this issue
  • I have made sure that that this bug is reproducible on the latest version of the package
  • I have provided all the information needed to reproduce this bug as efficiently as possible
  • I have sponsored this project