Giter VIP home page Giter VIP logo

h264-splitter's Introduction

h264-splitter

With this utility you can split a raw h264 file into chunk files with one NAL unit each.

Getting Started

Once this repository is cloned, type the following on terminal to create the executable h264Splitter3 and h264Splitter4

make all
  • h264Splitter3 for 001 header starter NAL unit
  • h264Splitter4 for 0001 header starter NAL unit

Prerequisites

This has been coded to run under Linux. (tested on pop-os!)

What Separator does my file have?

on Linux

I recommend you to use a binary reader such as xxd. Open a terminal and type the following

xxd <you_h264_file> | head -n 3

this will give you a result like this:

00000000: 0000 0001 6742 c01f da03 204d f961 0000  ....gB.... M.a..
00000010: 0300 0100 0003 003c 8f18 32a0 0000 0001  .......<..2.....
00000020: 68ce 32c8 0000 0106 05ff ff62 dc45 e9bd  h.2........b.E..

The important part is the first line

00000000: 0000 0001 6742 c01f da03 204d f961 0000  ....gB.... M.a..

we can conclude that this file uses a 0001 header starter, because it has 0000 0001 at the beginning. On the other hand, if your file has the following at the first line:

00000000: 0000 0167 42c0 1fda 0320 4df9 61000003  ...gB.... M.a...

your file has a 001 header starter.

on Mc or Windows

I recomend you to use a binary reader and check the first line

What if my file is mp4?

Remember that mp4 is a container and not a codec, so you have to use ffmpeg. Try this:

ffmpeg -i <your_file_name>.mp4 -an -vcodec libx264 -crf 23 <your_output_file_name>.h264

Running the tests

For running the splitter

./h264Splitter4 <your_h264_file>

this will generate one file per each NAL unit contained in your h264 file, it will start at 0 until the last NAL unit, like this:

<your_h264_file>.0000
<your_h264_file>.0001
<your_h264_file>.0003
.
.
.
<your_h264_file>.<last_NAL_unit>

Remember that NAL units can be interpreted as "frames"

Acknowledgment

h264-splitter's People

Contributors

ckevar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.