I have a problem with a video which has an audio stream longer than the video stream according to ffmpeg command line :
ffmpeg -i input.mp4 -vcodec copy -an -f null - <--- video stream duration
ffmpeg -i input.mp4 -acodec copy -an -f null - <--- audio stream duration
For example, the the first command gives a list of data including the stream duration of 3.64 and the second 3.80.
I need to retrieve the video stream duration on Swift. I tried this :
guard let videoAssetTrack = asset.tracks(withMediaType: AVMediaType.video).first else {
return
}
let duration: CMTime = videoAssetTrack.timeRange.duration
let durationTime = CMTimeGetSeconds(duration)
It gives me 3.80, not the value I was expecting.
Thank you for your attention, I hope you can help me on this case.