Skip to content

Can't set a frame rate for H264 codec - crash when using AverageNonDroppableFrameRate #7

Open
@mdmack

Description

@mdmack

Hi,

I'm trying to set a frame rate of 24 when using H264 codec and I don't see a way to do it.
I tried using AVVideoExpectedSourceFrameRateKey but that doesn't seem to effect final frame rate.
I tried setting AverageNonDroppableFrameRate but I'm getting a crash with NSInvalidArgumentException:
"Compression property AverageNonDroppableFrameRate is not supported for video codec type avc1"

I see that there's a default value of 30 based on this code:
if frameRate == 0 {
frameRate = 30
}
videoComposition.frameDuration = CMTimeMake(1, Int32(frameRate))

Changing this from 30 to 24 and not setting AverageNonDroppableFrameRate works.

I'm happy to open a pull request with some changes but would like to confirm the direction first.
One of the options is just to add a variable to NextLevelSessionExporter that would set the default frame rate - would that work?
Also, I might be wrong but it seems like the droppable frame rate and frame duration are not always the same values, might be good to separate those.

A related issue but in another pod if it's of value - https://stackoverflow.com/questions/44001641/using-avassetwriter-to-re-encode-h264-mov-file-how-to-set-frame-rate

Thanks,
Mike

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions