merged file writing to use single avssetwriter for both audio and video#5
merged file writing to use single avssetwriter for both audio and video#5sihekuang wants to merge 1 commit intoMnpn:mic-trackfrom
Conversation
There was a problem hiding this comment.
Thanks a lot for the PR! I do like the idea of and the changes you've made regarding consolidating the code. I have a few comments though:
-
When recording "System Audio", the microphone track will be included. This doesn't make much sense in my opinion, but maybe there are scenarios where you'd want both of those? This was avoided when using a separate audio-specific file writer; I think you could probably just check
if recordMic && !audioOnlyininitMedia()here instead -
I think there's a bug in here, as recording (sometimes..? I think it was working at first but now it consistently) causes a crash
Edit: This appears to have been an issue with my code, sorry! -
See my comment about the file format 👍
|
|
||
| if audioOnly{ | ||
| fileEnding = ud.string(forKey: "audioFormat") ?? "wat" | ||
| fileType = .m4a // it looks like file type m4a works for all tyle extensions. but maybe need to revise this |
There was a problem hiding this comment.
This actually doesn't work! While the file ending appears correct, the actual format in the file will be wrong. (So, for example, when recording Opus, you'll get a file with an AAC stream in a file named .ogg)
There was a problem hiding this comment.
thanks for the review! Sorry has been out for a while for the Christmas + New Year holidays. Let me get back and make this right. Thanks again and happy new year!
There was a problem hiding this comment.
No worries at all! Likewise, happy new year :)
use a single AVAssetWriter to write both audio and video so that we can capture the mic in both scenarios.