{"id":22018103,"url":"https://github.com/calm/tshalphavideos","last_synced_at":"2025-12-12T06:14:13.386Z","repository":{"id":34682597,"uuid":"38656440","full_name":"calm/TSHAlphaVideos","owner":"calm","description":"Play mp4 videos with alpha background on iOS","archived":false,"fork":false,"pushed_at":"2015-09-29T18:40:59.000Z","size":200,"stargazers_count":73,"open_issues_count":5,"forks_count":14,"subscribers_count":32,"default_branch":"master","last_synced_at":"2025-04-03T03:01:49.474Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/calm.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}},"created_at":"2015-07-07T01:33:50.000Z","updated_at":"2024-10-11T03:30:17.000Z","dependencies_parsed_at":"2022-08-28T13:01:13.904Z","dependency_job_id":null,"html_url":"https://github.com/calm/TSHAlphaVideos","commit_stats":null,"previous_names":["tsheaff/tshalphavideos"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calm%2FTSHAlphaVideos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calm%2FTSHAlphaVideos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calm%2FTSHAlphaVideos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calm%2FTSHAlphaVideos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/calm","download_url":"https://codeload.github.com/calm/TSHAlphaVideos/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252804219,"owners_count":21806771,"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":[],"created_at":"2024-11-30T05:09:55.738Z","updated_at":"2025-12-12T06:14:13.324Z","avatar_url":"https://github.com/calm.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TSHAlphaVideos\n\nPlay small mp4 videos with alpha background on iOS.  TSHAlphaVideos is powerful, performant and easy to use.\n\n![Example](http://i.imgur.com/B3MRxj3.gif)\n\nThis video is 53kb, way smaller than a PNG series or mov.\n\n### Installation\n\nIf you're on [CocoaPods](https://cocoapods.org/) (which you should be), then add this line to your `Podfile`:\n\n```ruby\npod 'TSHAlphaVideos'\n```\n\nOtherwise just drag and drop the files from [here](https://github.com/tsheaff/TSHAlphaVideos/tree/master/Pod/Classes) into your project.\n\nEither way, you'll also want to get a copy of [alpha_video.rake](https://github.com/tsheaff/TSHAlphaVideos/blob/master/alpha_video.rake) in your [rake path](https://github.com/ruby/rake).\n\n### Video Processing\n\nYou'll want to start with an .mov file that has alpha-channel.  AVPlayer would play this file directly, but doing so would likely require bundling or downloading a very large file -- movs with alpha can often approach 100MB per minute or more.\n\nExport your .mov premultiplied (matted) from AfterEffects or your video rendering software of choice. (In AfterEffects, choose the Animation codec which supports alpha, not H264 or any of the others)\n\nThen, with `alpha_video.rake` in your rake path, run\n\n```sh\nrake split_mov /path/to/matted/my_awesome_video.mov\n```\n\nYou'll be prompted to install two dependencies [1](http://www.mplayerhq.hu/DOCS/man/en/mplayer.1.html) [2](http://www.modejong.com/AVAnimator/utils.html).  The second dependency, AVAnimatorUtils, will require you to download the tarball manually and include the executables in your `$PATH`\n\nOnce you get those installed, the script should run and poop out a set of resulting files.  These will look like:\n\n```\nmy_awesome_video_audio.wav\nmy_awesome_video_alpha.mp4\nmy_awesome_video_rgb.mp4\nmy_awesome_video_no_audio.mp4\nmy_awesome_video.mp4\n```\n\nIf you don't have the final composited version, that's because your video had no audio.  Simply use the composited `*_no_audio.mp4` instead.  Either way, this will be the file you include in your app bundle.\n\nThis file should be significantly smaller than your .mov, perhaps by a factor of 100 or more.\n\n\n### Usage\n\nNow that you have your composited side-by-side RGB and Alpha channels, we'll use `TSHAlphaVideos` to show them to your users.  This is a very simple process, as simple as adding a UIImageView to the screen.\n\n```objc\nTSHAlphaVideoController *myAwesomeVideo = [TSHAlphaVideoController videoWithRGBVideoFile:@\"my_awesome_video\"\n                                                                            withDelegate:self];\n[self.view addSubview:myAwesomeVideo.view];\n[myAwesomeVideo play];\n```\n\nThat's it.  TSHAlphaVideoController has a few more configuration flags, like `repeats` and `stopInsteadOfPauseWhenViewEntersBackground` that can be set before calling `play`.  The view will be properly sized according to the video file.\n\nThe `TSHAlphaVideoDelegate` responds to a number of useful messages, all optional:\n\n```objc\n- (void)alphaVideoWillPlay:(TSHAlphaVideoController *)alphaVideo;\n- (void)alphaVideoDidPlay:(TSHAlphaVideoController *)alphaVideo;\n\n- (void)        alphaVideo:(TSHAlphaVideoController *)alphaVideo\ndidPlayFrameAtTimeInterval:(NSTimeInterval)timeInterval\n      previousTimeInterval:(NSTimeInterval)previousTimeInterval;\n\n- (BOOL)alphaVideoShouldStop:(TSHAlphaVideoController *)alphaVideo;\n- (void)alphaVideoWillStop:(TSHAlphaVideoController *)alphaVideo;\n- (void)alphaVideoDidStop:(TSHAlphaVideoController *)alphaVideo;\n\n- (void)memoryWarningStoppedVideo:(TSHAlphaVideoController *)alphaVideo;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalm%2Ftshalphavideos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcalm%2Ftshalphavideos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalm%2Ftshalphavideos/lists"}