Closed WilliamABradley closed 6 years ago
ping @martijn00
I found the issue, it turns out AVPlayer
can't play a video from AVCaptureSession
that has a .MP4 extension that is longer than 10 seconds by default.
This is due to fact that AVCaptureMovieFileOutput
creates a MovieFragment
every 10 seconds. MP4 doesn't support fragmentation, so for some reason all iOS devices can't play the video, but everything else can.
The fix:
var movieOutput = new AVCaptureMovieFileOutput
{
MovieFragmentInterval = CoreMedia.CMTime.Invalid
};
Turns out this library wasn't the issue, but the video created without this change that is > 10 seconds, <= 15 seconds isn't playable (Even in the Photos app!)
@WilliamABradley I am having a similar issue with Swifty Cam, a top Swift media capture library. Do you know of any solution in Swift?
I found the issue, it turns out
AVPlayer
can't play a video fromAVCaptureSession
that has a .MP4 extension that is longer than 10 seconds by default. This is due to fact thatAVCaptureMovieFileOutput
creates aMovieFragment
every 10 seconds. MP4 doesn't support fragmentation, so for some reason all iOS devices can't play the video, but everything else can.The fix:
var movieOutput = new AVCaptureMovieFileOutput { MovieFragmentInterval = CoreMedia.CMTime.Invalid };
Turns out this library wasn't the issue, but the video created without this change that is > 10 seconds, <= 15 s
I found the issue, it turns out
AVPlayer
can't play a video fromAVCaptureSession
that has a .MP4 extension that is longer than 10 seconds by default. This is due to fact thatAVCaptureMovieFileOutput
creates aMovieFragment
every 10 seconds. MP4 doesn't support fragmentation, so for some reason all iOS devices can't play the video, but everything else can.The fix:
var movieOutput = new AVCaptureMovieFileOutput { MovieFragmentInterval = CoreMedia.CMTime.Invalid };
Turns out this library wasn't the issue, but the video created without this change that is > 10 seconds, <= 15 seconds isn't playable (Even in the Photos app!)
this is accepted answers, Recently I got same issue and did changes in this file 'SwiftyCamViewController.swift' inside 'configureVideoOutput' method
let movieFileOutput = AVCaptureMovieFileOutput()
movieFileOutput.movieFragmentInterval = CoreMedia.CMTime.invalid ///Added to fix not recording sound for more than 10 second video when recording with camera
Hopefully this helps someone to fix this issue....