{"id":13905509,"url":"https://github.com/tangxbai/ffmpeg-helper","last_synced_at":"2026-05-08T04:14:23.459Z","repository":{"id":143965856,"uuid":"611070511","full_name":"tangxbai/ffmpeg-helper","owner":"tangxbai","description":"Ffmpeg helper library","archived":false,"fork":false,"pushed_at":"2023-03-24T08:21:34.000Z","size":910,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T05:45:02.393Z","etag":null,"topics":["ffmpeg","java","library"],"latest_commit_sha":null,"homepage":"","language":"Java","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/tangxbai.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","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-03-08T03:18:34.000Z","updated_at":"2023-03-24T15:09:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"96403302-3a71-4e06-838a-0f962e75f501","html_url":"https://github.com/tangxbai/ffmpeg-helper","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/tangxbai/ffmpeg-helper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangxbai%2Fffmpeg-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangxbai%2Fffmpeg-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangxbai%2Fffmpeg-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangxbai%2Fffmpeg-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tangxbai","download_url":"https://codeload.github.com/tangxbai/ffmpeg-helper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangxbai%2Fffmpeg-helper/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265345225,"owners_count":23750571,"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":["ffmpeg","java","library"],"created_at":"2024-08-06T23:01:17.404Z","updated_at":"2026-05-08T04:14:18.409Z","avatar_url":"https://github.com/tangxbai.png","language":"Java","funding_links":[],"categories":["HarmonyOS"],"sub_categories":["Windows Manager"],"readme":"# FFMPEG\n\n\n## 项目简介\n\nFFmpeg 的名称来自 MPEG 视频编码标准，前面的 “FF” 代表 “Fast Forward”，FFmpeg 是一套可以用来记录、转换数字音频、视频，并能将其转化为流的开源计算机程序。可以轻易地实现多种视频格式之间的相互转换。\n\nffmpeg-helper 在库的基础上将命令行进行了简单封装，从而使得我们将重心转移到 Api 的使用上，而无须关心命令行怎么拼接怎么传递给库的，并带来简便高效的命令扩展方式，以后就可以直接使用而不用去处理麻烦的执行命令了。\n\n*注意：此项目是一款完全开源的项目，您可以在任何适用的场景使用它，商用或者学习都可以，如果您有任何项目上的疑问，可以在issue上提出您问题，我会在第一时间回复您，如果您觉得它对您有些许帮助，希望能留下一个您的星星（★），谢谢。*\n\n------\n\n此项目遵照 [Apache 2.0 License]( http://www.apache.org/licenses/LICENSE-2.0.txt ) 开源许可。\n\n\n\n## 快速开始\n\nMaven方式（**推荐**）\n\n```xml\n\u003cdependency\u003e\n\t\u003cgroupId\u003ecom.viiyue.plugins\u003c/groupId\u003e\n\t\u003cartifactId\u003effmpeg-helper\u003c/artifactId\u003e\n\t\u003cversion\u003e[VERSION]\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n如果你没有使用Maven构建工具，那么你可以 [点击跳转下载页面](https://search.maven.org/search?q=g:com.viiyue.plugins%20AND%20a:ffmpeg-helper\u0026core=gav)。\n\n如何获取最新版本？[点击这里获取最新版本](https://search.maven.org/search?q=a:ffmpeg-helper)\n\n\n\n## 使用方式\n\n准备工作\n\n```java\n// 【必要】\n// 需要绑定本地 FFmpeg 程序库\n// 这一步必须要执行，否则无法正常使用相关 Api（用哪个设置哪个，不一定需要全部设）\nLibrary.FFMPEG.bind( \"/\u003cpath\u003e/bin/ffmpeg.exe\" ); \t-\u003e FFmpegExecutor\nLibrary.FFPROBE.bind( \"/\u003cpath\u003e/bin/ffprobe.exe\" ); \t-\u003e FFprobeExecutor\nLibrary.FFPLAY.bind( \"/\u003cpath\u003e/ffplay.exe\" ); \t\t-\u003e FFplayExecutor\n\n// 【可选】\n// 设置本地日志路径（默认存放于系统临时目录中）\nLibrary.setLogLocation( \"D:/dekstop\" );\n```\n\n命令执行器\n\n```java\n// FFmpeg\nFFmpegExecutor ffmpeg = FFmpegExecutor.build();\nffmpeg.hideBanner(); // -hide_banner\nffmpeg.logLevel( LogLevel.QUIET ); // -v quite\nffmpeg.codec( \"copy\" ); // -c [codec]\nffmpeg.xxx(); // -xx [value?]\nffmpeg.cmd( \"attr\", \"没有预设属性时，使用用这个方法\" ); // -attr [value?]\nffmpeg.input( \"/\u003cpath\u003e/xx.mp4\", ... ); // 指定输入源\nffmpeg.filters( filters ); // 添加视频效果过滤\nffmpeg.to( \"/\u003cpath\u003e/out.mp4\" ); // 输出到文件\n\n// FFproble\nFFprobeExecutor ffprobe = FFprobeExecutor.build();\nffprobe.hideBanner(); // -hide_banner\nffprobe.logLevel( LogLevel.QUIET ); // -v quite\nffprobe.xxx(); // -xx [value?]\nffprobe.cmd( \"attr\", \"没有预设属性时，使用用这个方法\" ); // -attr [value?]\nffprobe.input( \"/\u003cpath\u003e/xx.mp4\", ... ); // 指定输入源\nString content = ffprobe.to( \"[xml|json|ini|flat|scv]\" );\nString scv = ffprobe.toCSVString();\nString json = ffprobe.toJsonString();\nString flat = ffprobe.toFlatString();\nString ini = ffprobe.toInitring();\nOptional\u003cFFprobe\u003e opt = ffprobe.toBean();\n\n// FFplay\nHelpExecutor helper = HelpExecutor.ffmpeg();\nHelpExecutor helper = HelpExecutor.ffprobe();\nHelpExecutor helper = HelpExecutor.ffplay();\nhelper.hideBanner(); // -hide_banner\nhelper.logLevel( LogLevel.QUIET ); // -v quite\nhelper.cmd( \"attr\", \"没有预设属性时，使用用这个方法\" ); // -attr [value?]\nhelper.license();\nhelper.help();\nhelper.helpLong();\nhelper.xxx();\nString content = helper.getAndReturn();\n```\n\n效果过滤器\n\n```java\n// 创建过滤器\nFilters filters = Filters.simple(); // -vf\nFilters filters = Filters.complex(); // -filter_complex\n\n// 拆分流\nfilters.split().to( \"a\", \"b\", \"c\", ... ); // split[a][b][c][...]\nfilters.split( \"0:v\" ).to( \"a\", \"b\", \"c\", ... ); // [0:v]split[a][b][c]...\n\n// 添加过滤效果\nfilters.add( ... ); // 默认流\nfilters.stream( \"a\" ).add( ... ).tag( \"tagA\" ); // 指定流\nfilters.stream( \"b\" ).add( ... ).tag( \"tagB\" ); // 指定流\nfilters.stream( \"c\" ).add( ... ).tag( \"tagC\" ); // 指定流\n```\n\n直接使用示例\n\n```java\nFFmpegExecutor ffmpeg = FFmpegExecutor.build();\n\n// 分离视频流\nffmpeg.input( \"input.mp4\" ).codec( \"v\", \"copy\" ).disableAudio().to( \"output.mp4\" );\n// ffmpeg -i input.mp4 -c:v copy -an output.mp4\n\n// 分离音频流\nffmpeg.input( \"input.mp4\" ).codec( \"a\", \"copy\" ).disableVideo().to( \"output.mp4\" );\n// ffmpeg -i input.mp4 -a:v copy -vn output.mp4\n\n// 视频转码\nffmpeg.input( \"input.mp4\" )\n    .codec( \"v\", \"h264\" )\n    .size( 352, 278 )\n    .disableAudio()\n    .format( \"m4v\" )\n    .to( \"output.m4v\" );\n// ffmpeg -i input.mp4 -c:v h264 -s 342x278 -an -f m4v output.m4v\n\n// 合并视频音频\nffmpeg.input( \"video.mp4\", \"audio.mp3\" )\n    .codec( \"v\", \"copy\" )\n    .codec( \"a\", \"copy\" )\n    .to( \"output.mp4\" );\n// ffmpeg –i video.mp4 –i audio.mp3 –c:v copy –c:a copy output.mp4\n\n// 剪切视频\nffmpeg.search( \"00:01:30\", \"00:01:50\" ).input( \"input.mp4\" ).codec( \"copy\" ).to( \"output.mp4\" );\n// ffmpeg -ss 00:01:30 -to 00:01:50 -i input.mp4 -c copy output.mp4\n\n// 其他更多\nffmpeg.input( \"input.mp4\" ).xxx().to( \"output.mp4\" );\n// ffmpeg -i input.mp4 ... output.mp4\n```\n\n内置过滤器参照：\n\n```java\ncom.viiyue.ffmpeg.filter.video.*\n```\n\n\n\n\n## 关于作者\n\n- 邮箱：tangxbai@hotmail.com\n- 掘金： https://juejin.im/user/5da5621ce51d4524f007f35f\n- 简书： https://www.jianshu.com/u/e62f4302c51f\n- Issuse：https://github.com/tangxbai/ffmpeg-helper/issues\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftangxbai%2Fffmpeg-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftangxbai%2Fffmpeg-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftangxbai%2Fffmpeg-helper/lists"}