{"id":13905638,"url":"https://github.com/debugly/FFmpegTutorial","last_synced_at":"2025-07-18T03:30:57.800Z","repository":{"id":39491745,"uuid":"91244798","full_name":"debugly/FFmpegTutorial","owner":"debugly","description":"FFmpeg step by step tutorials for iOS/macOS developer. （适合零基础的 iOS/macOS 开发者学习FFmpeg API 和音视频渲染技术。演示了 OpenGL 和 Metal 等多种视频渲染方式，以及使用 AudioUnit 和 AudioQueue 渲染不同格式的音频。）","archived":false,"fork":false,"pushed_at":"2024-08-01T02:02:08.000Z","size":255653,"stargazers_count":290,"open_issues_count":0,"forks_count":60,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-08-06T23:30:00.312Z","etag":null,"topics":["audioqueue","audiounits","ffmpeg","ffmpeg-player","ios","learn-ffmpeg","macos","metal","opengl","opengles","tutorial","videoplayer","yuv","yuv2rgb"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","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/debugly.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":"2017-05-14T13:23:09.000Z","updated_at":"2024-08-06T01:49:35.000Z","dependencies_parsed_at":"2023-10-14T23:56:37.891Z","dependency_job_id":"d37fc80e-a213-421e-8d05-156ca5885ac9","html_url":"https://github.com/debugly/FFmpegTutorial","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/debugly%2FFFmpegTutorial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/debugly%2FFFmpegTutorial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/debugly%2FFFmpegTutorial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/debugly%2FFFmpegTutorial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/debugly","download_url":"https://codeload.github.com/debugly/FFmpegTutorial/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226336636,"owners_count":17608865,"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":["audioqueue","audiounits","ffmpeg","ffmpeg-player","ios","learn-ffmpeg","macos","metal","opengl","opengles","tutorial","videoplayer","yuv","yuv2rgb"],"created_at":"2024-08-06T23:01:20.245Z","updated_at":"2025-07-18T03:30:57.762Z","avatar_url":"https://github.com/debugly.png","language":"Objective-C","readme":"[![](md/imgs/ffmpeg.png)](https://ffmpeg.org/) \n\n\u003e 帮助零基础的 iOS/macOS 开发人员快速学习基于 FFmpeg 的音视频技术，主要包括了在 iOS/macOS 平台如何调用 FFmpeg 以及多种音视频渲染技术的对比。 \n\u003e \n\u003e 感觉有用的话给个 Star 吧😊\n\n[![Stargazers repo roster for @debugly/FFmpegTutorial](https://reporoster.com/stars/debugly/FFmpegTutorial)](https://github.com/debugly/FFmpegTutorial/stargazers)\n\n## iOS 示例工程:\n\n```bash\ngit clone https://github.com/debugly/FFmpegTutorial.git\ncd FFmpegTutorial\n./install-pre-any.sh ios\nopen Example/iOS/iOSExample.xcworkspace\n```\n\n运行效果:\n\n![](md/imgs/ios-snapshot-1.png)\n\n![](md/imgs/ios-snapshot-2.png)\n\n## macOS 示例工程:\n\n```bash\ngit clone https://github.com/debugly/FFmpegTutorial.git\ncd FFmpegTutorial\n./install-pre-any.sh macos\nopen Example/macOS/macOSExample.xcworkspace\n```\n\n![](md/imgs/macos-snapshot-1.png)\n\n![](md/imgs/macos-snapshot-2.png)\n\n![](md/imgs/macos-snapshot-3.png)\n\n## 简介\n\n所有对 FFmpeg6 的封装代码都放在 FFmpegTutorial 库里，执行 ./install-pre-any.sh 脚本时会自动下载已经预编译好的 FFmpeg 静态库，编译 FFmpeg 的脚本也是开源的 [MRFFToolChainBuildShell](https://github.com/debugly/MRFFToolChainBuildShell)。\n\n教程共分为六个部分，提供了 iOS 和 macOS 的上层调用示例，使用 Objective-C 语言开发:\n\n一、音视频基础\n\n- OpenGL Version: 查看编译FFmpeg时的配置信息、支持的协议、版本号以及 OpengGL 信息\n- Custom Thread: 封装 NSThread，方便后续调用\n- Movie Prober: 查看音视频流信息\n- Read Packet: 读取音视频包\n- Decode Packet: 音视频解码\n- Custom Decoder: 抽取解码类，封装解码逻辑\n\n二、视频渲染\n\n- Core API: 使用 Core Graphics/Core Image/Core Media 渲染视频帧\n- Legacy OpenGL/OpenGL ES2: 渲染 BGRA/NV12/NV21/YUV420P/UYVY/YUYV 视频桢\n- Modern OpenGL/OpenGL ES3: 渲染 BGRA/NV12/NV21/YUV420P/UYVY/YUYV 视频桢\n- Modern OpenGL(Rectangle Texture): 渲染 BGRA/NV12/NV21/YUV420P/UYVY/YUYV 视频桢\n- Metal: 渲染 BGRA/NV12/NV21/YUV420P/UYVY/YUYV 视频桢\n\n三、音频渲染\n\n- AudioUnit: 支持 S16,S16P,Float,FloatP 格式，采样率支持 44.1K,48K,96K,192K\n- AudioQueue: 支持 S16,Float格式，采样率支持 44.1K,48K,96K,192K\n- 封装 AudioUnit 和 AudioQueue 渲染逻辑，调用者无需感知\n\n四、封装播放器\n\n- VideoFrameQueue: 增加 VideoFrame 缓存队列，不再阻塞解码线程\n- PacketQueue: 增加 AVPacket 缓存队列，创建解码线程\n- VideoRendering Embed: 创建视频渲染线程，将视频相关逻辑封装到播放器内\n- AudioRendering Embed: 将音频相关逻辑封装到播放器内\n- Show Play Progress: 显示音视频播放进度\n- Sync Audio And Video: 音视频同步\n\n五、趣味实验\n\n- 黑白电视机雪花屏、灰色色阶图、三个小球\n\n六、跨平台播放器\n\n- [fsplayer](https://github.com/debugly/fsplayer)\n\n## 捐赠\n\n编写本教程花费了本人大量的时间，希望能够为新人学习音视频渲染提供一些帮助，请买杯咖啡给我提提神儿。\n\n![donate.jpg](https://i.postimg.cc/xdVqnBLp/IMG-7481.jpg)\n","funding_links":[],"categories":["HarmonyOS"],"sub_categories":["Windows Manager"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdebugly%2FFFmpegTutorial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdebugly%2FFFmpegTutorial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdebugly%2FFFmpegTutorial/lists"}