動画の長さに合わせて無音ファイルをカット
$ ffmpeg -ss 0 -i mute30.wav -t 16.45 mute.wav
無音ファイルと動画を結合
$ ffmpeg -i in.mp4 -i mute.wav -vf scale=886:1920,setsar=1:1 out.mp4
| import Synchronization | |
| public final class TaskScope: Sendable { | |
| public typealias Job = @Sendable () async -> () | |
| private let stream: AsyncStream<Job> | |
| private let continuation: AsyncStream<Job>.Continuation | |
| private let isRunning = Atomic<Bool>(false) | |
| public init() { |
| @MainActor protocol ComposableViewModel: DynamicProperty { | |
| associatedtype Body: View | |
| @ViewBuilder @MainActor func build(content: NonVisibleView) -> Self.Body | |
| } | |
| struct NonVisibleView: View { | |
| var body: some View { | |
| EmptyView() | |
| } | |
| } |
| import Foundation | |
| @dynamicMemberLookup | |
| struct Concat<L: Decodable, R: Decodable>: Decodable { | |
| init(left: L, right: R) { | |
| self.left = left | |
| self.right = right | |
| } | |
| private var left: L | |
| private var right: R |
| public struct RandomUInt8Sequence: Sequence { | |
| @usableFromInline var count: Int | |
| public init(count: Int) { | |
| self.count = count | |
| } | |
| public func makeIterator() -> Iterator { | |
| Iterator(self) | |
| } | |
| public struct Iterator: IteratorProtocol { |
| import Foundation | |
| func brokenTask() async { | |
| await withCheckedContinuation { (c) in | |
| // キャンセルシグナルが握りつぶされていて正しく中断しない処理 | |
| Task { | |
| try await Task.sleep(for: .seconds(5)) | |
| c.resume() | |
| } | |
| } |
| import Foundation | |
| func mySleep(seconds: Int) async { | |
| await withCheckedContinuation { c in | |
| DispatchQueue.global().asyncAfter(deadline: .now() + TimeInterval(seconds)) { | |
| c.resume() | |
| } | |
| } | |
| } |
| import Foundation | |
| enum MyValue { | |
| @TaskLocal static var foo: Int = 0 | |
| } | |
| func myFunc(@_inheritActorContext _ op: @Sendable @escaping () async -> ()) async { | |
| await withCheckedContinuation { c in | |
| DispatchQueue.global().async { | |
| Task { |
| var greeting = "Hello, playground" | |
| print(greeting, ProcessInfo.processInfo.processorCount) | |
| defer { | |
| print(greeting) | |
| } | |
| for i in 0..<30 { | |
| Task.detached { | |
| print("detached", i) | |
| sleep(1) |
| import Foundation | |
| @propertyWrapper | |
| public struct ThreadLocal<Value> { | |
| private let defaultValue: () -> Value | |
| private let name: String | |
| public init(wrappedValue: @autoclosure @escaping () -> Value) { | |
| self.defaultValue = wrappedValue | |
| self.name = UUID().uuidString |
動画の長さに合わせて無音ファイルをカット
$ ffmpeg -ss 0 -i mute30.wav -t 16.45 mute.wav
無音ファイルと動画を結合
$ ffmpeg -i in.mp4 -i mute.wav -vf scale=886:1920,setsar=1:1 out.mp4