Skip to content

Instantly share code, notes, and snippets.

利用 AVFoundation 和 Core Image 实现视频合成

百姓网在半年前启动了自己的短视频业务。经过多个版本的迭代,我们的移动端应用不光具备了短视频业务的基本能力, 还集成了一项杀手级功能——“魔力拍”。这项功能用起来大概是这样的:

魔力拍演示视频

“魔力拍”所做的事情简单来说就是视频合成。用户输入图片或文字,程序拿着用户的输入和原始视频模板经过一系列处理,最终生成目标视频。 业务流程看着非常简单:

@yimingtang
yimingtang / on-pegasus-3.md
Last active October 13, 2017 03:16
On Pegasus: Part 3

Pegasus:基于 React Native 的 App 动态化方案(下)

上期,我们介绍了 RN 中 JS 和 native 的通信方案,并以 native library 形式在我们的 app 内顺利集成了 RN 模块。今天我们继续讨论:

  1. RN 模块对外依赖的解决方案;
  2. RN 模块的开发和调试问题;
  3. RN 模块代码的动态部署问题。

对外依赖

@yimingtang
yimingtang / on-pegasus-2.md
Last active October 31, 2018 09:31
On Pegasus: Part 2

Pegasus:基于 React Native 的 App 动态化方案(中)

我们以 UIViewController 和 Activity 包裹 Component 的方式,迈出了百姓网主 app 接入 RN 的第一步。本期,我们将更具体地介绍 Pegasus 的设计和实现。着重回答以下问题:

  1. 怎么把 Pegasus 集成到已有的 native 项目?
  2. 怎么处理 RN 和 native 的互相通信?

集成

@yimingtang
yimingtang / on-pegasus-1.md
Last active June 22, 2018 06:40
On Pegasus: Part 1

Pegasus:基于 React Native 的 App 动态化方案(上)

React Native 和 app 动态化一直以来都是业内的热门话题。百姓网移动技术团队在过去一段时间就这两个话题展开了积极探索,并积累一点宝贵的人生经验。虽然作为分享者,我希望一下子把事情全讲清楚,但是限于移动端阅读体验,此次我们还是会分上、中、下三篇文章陆续发布。

在系列文章里,我们将注重讨论以下几个话题:

  1. 百姓网的 React Native 之路;
  2. RN 模块集成到已有 native 项目的方案;
  3. RN 模块中 JavaScript 和 native 代码通信问题;
  4. RN 模块对外依赖的解决方案;
@yimingtang
yimingtang / like.json
Last active August 14, 2017 10:55
Like animation
{"v":"4.10.1","fr":30,"ip":0,"op":28,"w":1242,"h":2208,"nm":"预合成 3","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"形状图层 1","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"n":["0p667_1_0p333_0"],"t":20,"s":[100],"e":[0]},{"t":28}],"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":0,"s":[0],"e":[-25]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":6,"s":[-25],"e":[-10]},{"t":10}],"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":0,"s":[548,1172,0],"e":[548,1150,0],"to":[0,-3.66666674613953,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":6,"s":[548,1150,0],"e":[548,1172,0],"to":[0,0,0],"ti":[0,-3.66666674613953,0]},{"t":8}],"ix":2},"a":{"a":0,"k":[-154,60,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0
@yimingtang
yimingtang / create_merge_request.rb
Created December 27, 2016 07:49
A fastlane action to create a new merge request on GitLab
module Fastlane
module Actions
module SharedValues
CREATE_MERGE_REQUEST_WEB_URL = :CREATE_MERGE_REQUEST_WEB_URL
end
class CreateMergeRequestAction < Action
def self.run(params)
require 'excon'
@yimingtang
yimingtang / .vimrc
Last active February 24, 2016 03:29
vimrc
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" ================ General Config ====================
set number "Line numbers are good
set backspace=indent,eol,start "Allow backspace in insert mode
set history=1000 "Store lots of :cmdline history
@yimingtang
yimingtang / UIImage+MyLibrary.h
Created August 9, 2015 13:31
UIImage+MyLibrary
//
// UIImage+MyLibrary.m
//
// Created by Yiming Tang on 7/9/15.
// Copyright (c) 2015 Yiming Tang. All rights reserved.
//
@import UIKit;
@interface UIImage (MyLibrary)
@yimingtang
yimingtang / NSBundle+MyLibrary.h
Last active August 29, 2015 14:27
NSBundle + Framework
//
// NSBundle+MyLibrary.h
// Pods
//
// Created by Yiming Tang on 8/4/15.
// Copyright (c) 2015 Yiming Tang. All rights reserved.
//
@import Foundation;
@yimingtang
yimingtang / setup.md
Last active August 29, 2015 14:24
Setup a Mac for iOS Development
  • Open Mac App Store and update all apps
  • Install Xcode
  • Install iTerm 2
  • Install Homebrew
  • Install zsh
  • Install Oh My Zsh
  • Install RVM
  • Install latest Ruby
  • Install Sublime Text 3
  • Install GitHub for Mac