{"id":16322284,"url":"https://github.com/p-x9/moviewriter","last_synced_at":"2025-10-24T12:32:15.207Z","repository":{"id":171959776,"uuid":"648484184","full_name":"p-x9/MovieWriter","owner":"p-x9","description":"🎥 Simple movie writing library for Swift","archived":false,"fork":false,"pushed_at":"2023-07-14T23:08:19.000Z","size":12,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-17T03:44:36.504Z","etag":null,"topics":["coremedia","movie","swiftpackage","swiftpackagemanager","video"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/p-x9.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-02T04:44:25.000Z","updated_at":"2023-08-18T05:23:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"6504c5d4-c0ac-4130-b8c6-9d6f953dab9d","html_url":"https://github.com/p-x9/MovieWriter","commit_stats":null,"previous_names":["p-x9/moviewriter"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p-x9%2FMovieWriter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p-x9%2FMovieWriter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p-x9%2FMovieWriter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p-x9%2FMovieWriter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/p-x9","download_url":"https://codeload.github.com/p-x9/MovieWriter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254150663,"owners_count":22023009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coremedia","movie","swiftpackage","swiftpackagemanager","video"],"created_at":"2024-10-10T22:50:29.077Z","updated_at":"2025-10-24T12:32:10.171Z","avatar_url":"https://github.com/p-x9.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MovieWriter\nSimple movie writing library for Swift\n\n\u003c!-- # Badges --\u003e\n\n[![Github issues](https://img.shields.io/github/issues/p-x9/MovieWriter)](https://github.com/p-x9/MovieWriter/issues)\n[![Github forks](https://img.shields.io/github/forks/p-x9/MovieWriter)](https://github.com/p-x9/MovieWriter/network/members)\n[![Github stars](https://img.shields.io/github/stars/p-x9/MovieWriter)](https://github.com/p-x9/MovieWriter/stargazers)\n[![Github top language](https://img.shields.io/github/languages/top/p-x9/MovieWriter)](https://github.com/p-x9/MovieWriter/)\n\n## Document\n### Import and create instance of `MovieWriter`\n```swift\nlet movieWriter = MovieWriter(\n    outputUrl: outputURL, // Movie outpur URL\n    size: UIScreen.main.bounds.size, // frame size\n    codec: .h264,  // video codec\n    audioFormatId: kAudioFormatMPEG4AAC, // audio format\n    audioSampleRate: 44100.0, // sample rate of audio\n    audioNumberOfChannel: 2, // number of channel\n    fileType: .mp4 // file type\n)\n```\n\n### If You use Audio or Microphone\nIf you want to write audio or microphone audio, you need to configure the following settings.\n```swift\nmovieWriter.isAudioEnabled = true\nmovieWriter.isMicrophoneEnabled = true\n```\n\n### Start Writing\nIf `waitFirstWriting` is true, align the first write with the start time of the video.\nOtherwise, the time when this method is called is the start time of the video, and the video will be blank until the time of the writing.\n```swift\ntry movieWriter.start(waitFirstWriting: true)\n```\n\n### Write Buffer\n#### Video\n```swift\ntry movieWriter.writeFrame(buffer) // write with `CMSampleBuffer`\n/* or */\ntry movieWriter.writeFrame(buffer, at: time) // write with `CVSampleBuffer`\n```\n#### Audio and Microphone\n```swift\ntry movieWriter.writeAudio(buffer) // Audio\ntry movieWriter.writeMicrophone(buffer) // Audio\n```\n\n### End Writing\nSpecify an end time to finish writing.\nIf `waitUntilFinish` is true, it will not return until the end process is completely finished\n```swift\ntry movieWriter.end(at: time, waitUntilFinish: true)\n```\n\n### Access to AVKit-related properties\nThe following import allows access to internal properties related to AVKit.\n```swift\n@_spi(AVKit) import MovieWriter\n```\nYou will have access to the following properties\n- assetWriter: AVAssetWriter?\n- writerInput: AVAssetWriterInput?\n- adaptor: AVAssetWriterInputPixelBufferAdaptor?\n- audioWriterInput: AVAssetWriterInput?\n- micWriterInput: AVAssetWriterInput?\n\n## License\n\nMovieWriter is released under the MIT License. See [LICENSE](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fp-x9%2Fmoviewriter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fp-x9%2Fmoviewriter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fp-x9%2Fmoviewriter/lists"}