aizvorski / h264bitstream

A complete set of functions to read and write H.264 video bitstreams, in particular to examine or modify headers.
GNU Lesser General Public License v2.1
713 stars 237 forks source link

Write a h264 stream copy-paste using this library #42

Open aegroto opened 3 years ago

aegroto commented 3 years ago

Hello,

I'd need to write a small tool that reads an h264 file, reads the NALs, modifies current data and eventually adds new units (more specifically, SEI data). I would like to start from a simple tool that copy-pastes an h264 bitstream from one file to another, with the output one being readable by players like mpv or derived tools like https://mradionov.github.io/h264-bitstream-viewer/.

This is what's being reported in the README:

'Reading and writing slice data is complex and may not be fully implemented soon (target: 1.0.0 version), although there is some work-in-progress code for it.'

Does this mean that it's possible to use this library to manipulate actual h264 data, obtaining playable results? If not, could you please guide me through the steps that would be needed to realize such a copy-paste tool? I have not been able to find any suitable example, although it should be one of the simplest usages of this library. Thanks in advance!