Embedding Metadata to H.264 encoded file

可紊 提交于 2019-12-06 07:28:14

问题


I am currently developing an application which produces certain metadata with respect to preview frames coming from the camera. I can see this metadata being produced properly and I have no problems here.

However, I have to embed this metadata to these frames of interest (frames are processed by a native algorithm to produce this metadata). I am using ffmpeg with x264 to encode the frames into H.264. I have checked x264.h and some documentations but failed to find what I seek.

My question is; is there any unused portion of H.264 syntax that I can embed my metadata to encoded frames?

I hope I was clear enough. Thanks in advance.


回答1:


Most video elementary streams have a provision for "user data". In h.264 this is part of the SEI nal unit. You can add one before every frame you want to associate it with. I don't think that x264 has support to add user data from outside.

Two choices:

  1. Modify x264 / ffmpeg to add the SEI message where ever you want it taking input in some form you like.
  2. Create your stream, create your metadata. Now write a small program separately to read your metadata and parse the files and push a SEI NAL before the frame you want.

For SEI syntax you should be able to google and get it. The best place to look though is the H.264 standard. A easier way is to just look at the code in x264. It does insert one user data at the begining (the encoding parameters).



来源:https://stackoverflow.com/questions/12320604/embedding-metadata-to-h-264-encoded-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!