{"id":15066387,"url":"https://github.com/caijinglong/bmff","last_synced_at":"2025-04-10T14:22:04.286Z","repository":{"id":65684638,"uuid":"480744816","full_name":"CaiJingLong/bmff","owner":"CaiJingLong","description":"The package provides a library for reading ISO Base Media File Format (BMFF) files.","archived":false,"fork":false,"pushed_at":"2024-10-08T07:33:04.000Z","size":140,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T13:04:13.183Z","etag":null,"topics":["bmff","dart","heic","isobmff","mp4"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CaiJingLong.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":"2022-04-12T09:42:18.000Z","updated_at":"2024-10-08T07:33:08.000Z","dependencies_parsed_at":"2023-02-19T15:30:38.530Z","dependency_job_id":null,"html_url":"https://github.com/CaiJingLong/bmff","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaiJingLong%2Fbmff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaiJingLong%2Fbmff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaiJingLong%2Fbmff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaiJingLong%2Fbmff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CaiJingLong","download_url":"https://codeload.github.com/CaiJingLong/bmff/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248233935,"owners_count":21069493,"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":["bmff","dart","heic","isobmff","mp4"],"created_at":"2024-09-25T01:07:00.759Z","updated_at":"2025-04-10T14:22:04.262Z","avatar_url":"https://github.com/CaiJingLong.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bmff of dart\n\nThe package provides a library for reading ISO Base Media File Format (BMFF) files.\n\n## Usage\n\n```yaml\ndependencies:\n  bmff: any\n```\n\n```dart\nimport 'package:bmff/bmff.dart';\n```\n\n## Example\n\n### Simple example\n\n\u003cdetails\u003e\n\n\u003csummary\u003eClick to show codes\u003c/summary\u003e\n\n```dart\nimport 'package:bmff/bmff.dart';\n\nvoid main() {\n  final assetPath = 'assets/compare_still_1.heic';\n  final bmff =\n      Bmff.file(assetPath); // The path is file path, not flutter asset path.\n\n  final boxes = bmff.childBoxes;\n  for (final box in boxes) {\n    print(box);\n  }\n\n  showFtyp(bmff);\n}\n\nvoid useByteListSource(List\u003cint\u003e bytes) {\n  final bmff = Bmff.memory(bytes);\n  final boxes = bmff.childBoxes;\n  for (final box in boxes) {\n    print(box);\n  }\n}\n\nvoid showFtyp(Bmff bmff) {\n  final typeBox = bmff.typeBox;\n  final type = typeBox.type;\n\n  final majorBrand = typeBox.majorBrand;\n  final minorVersion = typeBox.minorVersion;\n  final compatibleBrands = typeBox.compatibleBrands;\n\n  print('type: $type');\n  print('majorBrand: $majorBrand');\n  print('minorVersion: $minorVersion');\n  print('compatibleBrands: $compatibleBrands');\n}\n\n```\n\n```log\nftyp (len = 24, start = 0, end = 24)\nmeta (len = 315, start = 24, end = 339)\nmdat (len = 37933, start = 339, end = 38272)\ntype: ftyp\nmajorBrand: mif1\nminorVersion:\ncompatibleBrands: [mif1, heic]\n```\n\n\u003c/details\u003e\n\n### Async context example\n\n\u003cdetails\u003e\n\n\u003csummary\u003eClick to show codes\u003c/summary\u003e\n\n```dart\nimport 'package:bmff/bmff.dart';\nimport 'package:http/http.dart' as http;\n\nFuture\u003cvoid\u003e main(List\u003cString\u003e args) async {\n  // final uri = Uri.parse('https://www.w3school.com.cn/i/movie.mp4');\n  final uri = Uri.parse(\n      'http://vfx.mtime.cn/Video/2019/03/18/mp4/190318231014076505.mp4');\n  final bmff = await Bmff.asyncContext(AsyncBmffContextHttp(uri));\n  for (final box in bmff.childBoxes) {\n    showBoxInfo(0, box);\n  }\n}\n\nvoid showBoxInfo(int level, AsyncBmffBox box) {\n  final levelPrefix = '    ' * level;\n  print('$levelPrefix${box.type} ${box.realSize}');\n\n  for (final child in box.childBoxes) {\n    showBoxInfo(level + 1, child);\n  }\n}\n\n// part download http context\nclass AsyncBmffContextHttp extends AsyncBmffContext {\n  final Uri uri;\n\n  const AsyncBmffContextHttp(this.uri);\n\n  @override\n  Future\u003cList\u003cint\u003e\u003e getRangeData(int start, int end) async {\n    final response = await http.get(uri, headers: {\n      'Range': 'bytes=$start-${end - 1}',\n    });\n    if (response.statusCode != 206) {\n      throw Exception(\n          'Current http status code is ${response.statusCode},' +\n          ' not 206, not support range download');\n    }\n    final bytes = response.bodyBytes;\n    return bytes;\n  }\n\n  @override\n  Future\u003cint\u003e lengthAsync() async {\n    final response = await http.head(uri);\n    final contentLength = response.headers['content-length'];\n    if (contentLength != null) {\n      return int.parse(contentLength);\n    } else {\n      throw Exception('content-length not found');\n    }\n  }\n}\n\n```\n\n```log\nftyp 32\nmoov 44331\n    mvhd 108\n    trak 20456\n    trak 23640\n    udta 119\nfree 8\nmdat 7538059\n```\n\n\u003c/details\u003e\n\n### All examples\n\nSee [example](https://github.com/CaiJingLong/bmff/blob/main/example).\n\n## Other resources\n\n[ISO Base Media File Format (BMFF)][isobmff]\n[The project wiki][wiki]\n\n## LICENSE\n\n[BSD 3-Clause License](https://github.com/CaiJingLong/bmff/blob/main/LICENSE)\n\n[isobmff]: https://mpeg.chiariglione.org/standards/mpeg-4/iso-base-media-file-format\n[wiki]: https://github.com/CaiJingLong/bmff/wiki\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaijinglong%2Fbmff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaijinglong%2Fbmff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaijinglong%2Fbmff/lists"}