{"id":13907610,"url":"https://github.com/mediagoom/mg","last_synced_at":"2025-07-18T06:30:39.550Z","repository":{"id":76724921,"uuid":"74013685","full_name":"mediagoom/mg","owner":"mediagoom","description":"mg tool let you statically package MP4 files into MPEG-DASH and HLS.","archived":false,"fork":false,"pushed_at":"2019-05-09T13:08:18.000Z","size":17725,"stargazers_count":29,"open_issues_count":0,"forks_count":7,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-11-25T16:38:58.627Z","etag":null,"topics":["dash","hls","hls-live-streaming","mp4-files","mpeg","mpeg-dash","video","video-streaming"],"latest_commit_sha":null,"homepage":"https://mediagoom.com","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mediagoom.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}},"created_at":"2016-11-17T09:55:26.000Z","updated_at":"2024-07-14T14:13:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"8be4af1a-842a-43a1-8b15-6f5a4a42c765","html_url":"https://github.com/mediagoom/mg","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/mediagoom/mg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mediagoom%2Fmg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mediagoom%2Fmg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mediagoom%2Fmg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mediagoom%2Fmg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mediagoom","download_url":"https://codeload.github.com/mediagoom/mg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mediagoom%2Fmg/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265710530,"owners_count":23815373,"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":["dash","hls","hls-live-streaming","mp4-files","mpeg","mpeg-dash","video","video-streaming"],"created_at":"2024-08-06T23:02:01.730Z","updated_at":"2025-07-18T06:30:38.581Z","avatar_url":"https://github.com/mediagoom.png","language":"C++","funding_links":[],"categories":["HarmonyOS"],"sub_categories":["Windows Manager"],"readme":"# mg\n\n[![Build Status](https://travis-ci.org/mediagoom/mg.svg?branch=master)](https://travis-ci.org/mediagoom/mg)\n[![Win Build Status](https://ci.appveyor.com/api/projects/status/github/mediagoom/mg?branch=master\u0026svg=true)](https://ci.appveyor.com/project/aseduto/mg)\n[![codecov](https://codecov.io/gh/mediagoom/mg/branch/master/graph/badge.svg)](https://codecov.io/gh/mediagoom/mg)\n\n\n\n## Essential Open Source Web Media Streaming\n\n**Use MPEG-DASH and HLS to effectively serve your video.**\n\nmg packages MP4 files in order to be streamed on web.\nOnce they are packaged you may deploy your video to any web server to stream it.\n\nAdd or improve your video communication.\nMediaGoom let you use video on the web effectively since using adaptive streaming let you:\n- improve media startup time\n- use your bandwidth evenly\n- give each user the best possible experience based on their bandwidth\n\t\t\t\t\nEssential since does not require any infrastructure in your site in order to achieve this. It just uses plain files.\n\t\t\t\t\nIn order to produce mp4 file to be consumed by mg you can follow this guide:  [How to encode files to use with mg](../../wiki/encode)\n\n\n### Packaging\n\nmg  allows you to package your MP4 files. In this way you they can be effectively streamed on the Internet.\n\nPackaging format:\n\n 1. [Dynamic Adaptive Streaming over HTTP (DASH)](https://en.wikipedia.org/wiki/Dynamic_Adaptive_Streaming_over_HTTP)\n 2. [Http Live Stream (HLS)](https://en.wikipedia.org/wiki/HTTP_Live_Streaming)\n 2. [Smooth Streaming](https://en.wikipedia.org/wiki/Adaptive_bitrate_streaming#Microsoft_Smooth_Streaming)\n\n\nIn order to generate the dash segments using mg you should have available one or more MP4 files.\nAll this files should be *gop aligned*.\n\n[Read here](../../wiki/encode) to know how to produce your files in case you do not have them.\n\nIn order to verify that your files are *gop aligned* you can use this command:\n```bash\nmg -k:gop -i:\u003cmp4 file\u003e\n```\nRunning the same command on all file should result in the same gop list. Some file could have more gop. However all files should have the same gops even if gops in between are different.\n\nOnce you have verified the input file are correct, you can use mg to produce either or both the mpeg dash or hls segments:\n\n```bash\nmg -k:adaptive -o:\u003coutput directory\u003e \\\n-i:\u003cfirst file\u003e -b:\u003cfirst bitrate\u003e -s:0 -e:0 \\\n-j:\u003csecond file\u003e -b:\u003csecond bitrate\u003e \\\n-j:\u003cthird file\u003e -b:\u003ctherd bitrate\u003e \\\n-j:\u003cnth file\u003e -b\u003cnth bitrate\u003e\n```\n\nFor instance if you followed the [explanation to encode a media file](../../wiki/encode) you could have the following files:\n- test_1024x576_h264-750Kb_aac-lc.mp4\n- test_1280x720_h264-1200Kb_aac-lc.mp4\n- test_1280x720_h264-2000Kb_aac-lc.mp4\n- test_1280x720_h264-3500Kb_aac-lc.mp4\n- test_256x144_h264-120Kb_aac-lc.mp4\n- test_512x288_h264-320Kb_aac-lc.mp4\n\nSo your command line should be:\n\n**Bash**\n```bash\nmkdir dash\nmg -k:dash -o:./dash \\\n-i:./test_1024x576_h264-750Kb_aac-lc.mp4 -b:750 -s:0 -e:0 \\\n-j:./test_1280x720_h264-1200Kb_aac-lc.mp4 -b:1200 \\\n-j:./test_1280x720_h264-2000Kb_aac-lc.mp4 -b:2000 \\\n-j:./test_1280x720_h264-3500Kb_aac-lc.mp4 -b:3500 \\\n-j:./test_256x144_h264-120Kb_aac-lc.mp4 -b:120 \\\n-j:./test_512x288_h264-320Kb_aac-lc.mp4 -b:320\n```\n\n**Powershell**\n```powershell\nmkdir dash\nmg -k:adaptive -o:./dash \\\n-i:./test_1024x576_h264-750Kb_aac-lc.mp4 -b:750 -s:0 -e:0 `\n-j:./test_1280x720_h264-1200Kb_aac-lc.mp4 -b:1200 `\n-j:./test_1280x720_h264-2000Kb_aac-lc.mp4 -b:2000 `\n-j:./test_1280x720_h264-3500Kb_aac-lc.mp4 -b:3500 `\n-j:./test_256x144_h264-120Kb_aac-lc.mp4 -b:120 `\n-j:./test_512x288_h264-320Kb_aac-lc.mp4 -b:320\n```\n\nOnce you have your directory with *mpeg-dash* segment you can [publish](../../wiki/serve) them in a Web Server.\n\n### Editing and ad insertion\nYou can create a stream, which is a subset and or a join of multiple content.\nAt the moment time is inputted in mg as hundreds of nanoseconds. This means milliseconds multiply by 10000.\nFor a simple example let say you have a file with your major content whit a length of 2 minutes. You also have a small ad which you want to insert exactly in the middle.\nFirst of all you should [produce the same bitrates files for both contents](../../wiki/encode). \nLet’s say you have 2 bitrates for both content. You would have 4 files:\n- main_content_low_bitrate.mp4\n- main_content_high_bitrate.mp4\n- ad_content_low_bitrate.mp4\n- ad_content_high_bitrate.mp4\nNow the following command would produce streaming content with the add in the middle:\n```bash \nmg -k:adaptive -o:./outputdir \\\n-s:0 -e:600000000 -i:main_content_low_bitrate.mp4 -b:300 \\\n-j: main_content_high_bitrate.mp4 -b:1500 \\\n-s:0 -e: 0 -i:ad_content_low_bitrate.mp4 -b:300 \\\n-j: ad_content_high_bitrate.mp4 -b:1500 \\\n-s: 600000000 -e: 0 -i:main_content_low_bitrate.mp4 -b:300 \\\n-j: main_content_high_bitrate.mp4 -b:1500 \\\n```\nThe above command line is telling mg to add to the streaming output 1 minutes of the main content with two bitrates. Then add all the content of the ad. Finally add the main content starting from 1 minutes to the end.\n\n### Contributing\nContribution are welcome.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmediagoom%2Fmg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmediagoom%2Fmg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmediagoom%2Fmg/lists"}