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

Add movieFragmentInterval option #67

Closed
wants to merge 1 commit into from
Closed

Conversation

drag0s
Copy link

@drag0s drag0s commented May 14, 2019

Add option to customize movieFragmentInterval. The default will be the same as before (.invalid)

Probably it didn't worked before because you were trying with mp4 containers, but it does work with mov containers and it's nice to be able to change this option.

@@ -60,7 +61,7 @@ public final class Aperture: NSObject {

// Needed because otherwise there is no audio on videos longer than 10 seconds
// http://stackoverflow.com/a/26769529/64949
output.movieFragmentInterval = .invalid
output.movieFragmentInterval = movieFragmentInterval != nil ? CMTimeMake(value: movieFragmentInterval!, timescale: 1) : .invalid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMTimeMake is legacy. Use the more modern initializer.

@sindresorhus sindresorhus changed the title Add movieFragmentInterval option Add movieFragmentInterval option May 29, 2019
@sindresorhus
Copy link
Contributor

but it does work with mov containers and it's nice to be able to change this option.

How are you using a mov container with Aperture?

@@ -40,6 +40,7 @@ public final class Aperture: NSObject {
highlightClicks: Bool,
screenId: CGDirectDisplayID = .main,
audioDevice: AVCaptureDevice? = .default(for: .audio),
movieFragmentInterval: Int64? = nil,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a doc comment about what this does and what it's useful for?

@skllcrn
Copy link
Member

skllcrn commented Aug 6, 2019

Checking in @drag0s, would you still like to continue on this implementation?

@drag0s
Copy link
Author

drag0s commented Aug 8, 2019

Hey there, sorry for my delayed response.

How are you using a mov container with Aperture?

I use a mov container with Aperture saying that the destination path is a file ending in .mov.

The main problem about not using movieFragmentInterval is that if, in this case the Aperture process, would crash, is killed or terminated for whatever reason; you would have an unusable output movie file.

In the case of using movieFragmentInterval with mov containers you would have a usable mov file that you could watch because was periodically inserting (every movieFragmentInterval) "movie fragments" into the output file, hence you could watch the movie up to the point where the last fragment was written.

movieFragmentInterval doesn't work well with mp4 files

Checking in @drag0s, would you still like to continue on this implementation?

Yes, as long as you guys think it's worth adding it!

@sindresorhus
Copy link
Contributor

I didn't realize the API automatically chose the correct container based on the output URL extension. Do we even need an option at all? Can't we just use movieFragmentInterval when the output URL extension is mov? (And also document that of course)

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

Successfully merging this pull request may close these issues.

3 participants