Ypimagepicker: No audio when recording long mp4

Created on 15 May 2019  路  3Comments  路  Source: Yummypets/YPImagePicker

Describe the bug
When I try to record a video with mp4 format, the video has no audio if it is longer than 30 seconds.

To Reproduce
set filetype to mp4 and record a long video

Environment (please complete the following information):

  • Device: iPhone XS
  • OS: iOS 12.2
  • Xcode Version 10.2.1
  • Swift Version 5

Installation Type

  • Cocoapods

Most helpful comment

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.

I created a PR and hopefully we can get @s4cha or someone from the Yummypets team to merge quickly :)

The fix:

private var videoOutput = AVCaptureMovieFileOutput()
videoOutput.movieFragmentInterval = .invalid

PR: https://github.com/Yummypets/YPImagePicker/pull/359

All 3 comments

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.

I created a PR and hopefully we can get @s4cha or someone from the Yummypets team to merge quickly :)

The fix:

private var videoOutput = AVCaptureMovieFileOutput()
videoOutput.movieFragmentInterval = .invalid

PR: https://github.com/Yummypets/YPImagePicker/pull/359

@Berk-Kaya Thank you for reporting this. @gintechsystems Can't thank you enough for finding the issue and taking the time to make the fix, this is greatly appreciated :) This will be in the next version.

Closing this as this is now solved :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

StackHelp picture StackHelp  路  4Comments

roarapps picture roarapps  路  4Comments

esabunor picture esabunor  路  5Comments

pngo-hypewell picture pngo-hypewell  路  7Comments

javiermanzo picture javiermanzo  路  6Comments