Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS Recorded Video playback is mute when > 10 Seconds #384

Closed
2 of 7 tasks
WilliamABradley opened this issue May 4, 2018 · 4 comments
Closed
2 of 7 tasks

iOS Recorded Video playback is mute when > 10 Seconds #384

WilliamABradley opened this issue May 4, 2018 · 4 comments

Comments

@WilliamABradley
Copy link

WilliamABradley commented May 4, 2018

Steps to reproduce 📜

Repro repo: https://github.com/WilliamABradley/VideoCaptureDemo

  1. Run the App on an iOS Device (Problem observed on iPad Pro (2nd Gen w/ 11.3), enable Permissions for Microphone and Camera.

  2. Record Video for 11 seconds or longer (Down to 4 on the Countdown)

  3. Play the Video back on the Playback page, there is no sound.

Expected behavior 🤔

Any video length should playback with audio.

Actual behavior 🐛

Videos longer than 11 seconds play with no audio.
Audio is contained in the file, as when uploaded to Dropbox, it has audio.

I have tried delaying playback of the player, thinking that maybe a file handle was still open, saving the audio data, but this does not work, and playing the video cold (App restart, the audio is still mute).

Configuration 🔧

Version: 2.x

Platform:

  • 📱 iOS
  • 🤖 Android
  • 🏁 WPF
  • 🌎 UWP
  • 🍎 MacOS
  • 📺 tvOS
  • 🐒 Xamarin.Forms
@WilliamABradley
Copy link
Author

ping @martijn00

@WilliamABradley
Copy link
Author

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!)

@Ludotrico
Copy link

@WilliamABradley I am having a similar issue with Swifty Cam, a top Swift media capture library. Do you know of any solution in Swift?

@sumitkapoorshineweb
Copy link

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 s

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!)

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....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants