{"id":15677776,"url":"https://github.com/kmsquire/split_video","last_synced_at":"2025-10-09T09:14:13.690Z","repository":{"id":35275094,"uuid":"39535860","full_name":"kmsquire/split_video","owner":"kmsquire","description":"Split and recode an mp4 video into evenly sized chunks.","archived":false,"fork":false,"pushed_at":"2015-07-25T22:30:40.000Z","size":136,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-31T05:03:23.445Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"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/kmsquire.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-22T23:51:51.000Z","updated_at":"2024-04-22T14:55:01.000Z","dependencies_parsed_at":"2022-09-07T15:12:50.841Z","dependency_job_id":null,"html_url":"https://github.com/kmsquire/split_video","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/kmsquire%2Fsplit_video","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmsquire%2Fsplit_video/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmsquire%2Fsplit_video/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmsquire%2Fsplit_video/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kmsquire","download_url":"https://codeload.github.com/kmsquire/split_video/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252798415,"owners_count":21805876,"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":[],"created_at":"2024-10-03T16:11:37.648Z","updated_at":"2025-10-09T09:14:08.656Z","avatar_url":"https://github.com/kmsquire.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"split_video\n===========\n\nSplit and recode an mp4 video into evenly sized chunks.\n\nUsage:\n\n    ./split_video [--gop-size 30] [--chunk-size 120] [--skip 123]\n                  [--length 1200] input_file output_template\n\nwhere\n\n    --gop-size   is the size of a group of pictures\n    --chunk-size is the size of a chunk in frames\n    --skip       are the number of frames to skip at the\n                 beginning of the input file\n    --length     are the number of frames to encode\n\nExample:\n\n    ./split_video --gop-size 25 --chunk-size 100 myfile.mp4 chunks/%05d.mp4\n\nwill split a video into chunks of size 100, with I-frames every 25 frames.\n\nNotes\n=====\nffmpeg itself has been adding functionality for chunking video in recent versions.\n\nFor an input file at 25 fps, the following command almost produces 120 frame chunks:\n\n    ffmpeg -i input.mp4 -f segment -segment_time 4.8 \\\n        -segment_format_options movflags=+faststart \\\n        -force_key_frames '\"expr:eq(mod(n,30),0)\"' \\\n        -vcodec h264 -pix_fmt yuv420p \\\n        -crf 18 \\\n        -flags +global_header \\\n        chunks/%05d.mp4\n\nHowever, I found that occasionally, 119 or 121 frame chunks would be produced, and\nfor my needs, I wanted all chunks to be exactly 120 frames.  So I wrote this tool.\n\nCaveats\n=======\n1. audio information is not preserved\n2. only tested on mp4 files, and makes some mp4 specific assumptions\n3. assumes fixed frame rate encoding\n4. only outputs I and P frames (no B frames)\n\nThe code could also use some cleanup, but it works for my use case.\n\nFuture Work\n===========\nI have no plans to extend this right now, but I'll gladly accept pull requests\nwhich update the code.  Possible extensions\n\n* include audio\n* generalize to other video codecs, variable rate encoding\n* for mp4, output B frames\n\nSources\n=======\nBased on [ffmpeg sample code](https://www.ffmpeg.org/doxygen/2.7/examples.html).\nBSD-style license (see License.txt).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkmsquire%2Fsplit_video","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkmsquire%2Fsplit_video","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkmsquire%2Fsplit_video/lists"}