PDA

View Full Version : Add datas to a stream


MatLz
29th November 2009, 10:53
When we split h264 streams (with DGavcindex,MKVMerge,Yamb...), datas like codecs settings are lost except for the first part.
I found a little tip to add these datas to the other parts.
With a simple hex editor, just isolate the part which contain the datas, save the segment. Rename it in .264 and do:

(a.264 is the segment which only contains datas, b.264 is the part without datas, c.264 is the resulting file. Names are examples of course)

copy /b "a.264" + "b.264" "c.264"
:cool:

MatLz
29th November 2009, 10:57
Maybe it has been already discussed...but if it is so simple, why not implement that in the tools which can split streams?

roozhou
29th November 2009, 11:09
What does your a.264 contain? SPS, PPS, SEI? How did you isolate this with a hex editor?

MatLz
29th November 2009, 11:18
What does your a.264 contain? SPS, PPS, SEI? How did you isolate this with a hex editor?
I don't know what are SPS, PPS or SEI...sorry!
I used the Virtualdub hexadecimal editor.

roozhou
29th November 2009, 13:38
I don't know what are SPS, PPS or SEI...sorry!
I used the Virtualdub hexadecimal editor.
Well, could you tell me where the segment is, from which byte to which byte? IMO VD does not have a parser for H264 bitstream.

MatLz
29th November 2009, 14:08
I can't tell you where it begins for you!! It's depending on your codec settings!
For me in the Virtualdub's hexadecimal editor, the stream without the datas begins by:
...gdThe stream with the datas is:...."DATAS".....gdSo in the code of the stream with the datas, I simply put the cursor on the "." before "...gd" then "edition", "extract segment", change the "hexa adress" to the "hexa length", puted 0 to "hexa adress", "ok" to save.

roozhou
29th November 2009, 16:18
I think you messed up everything and you have no idea how to use a hex editor. Plz use HEX string like '00 23 AB' instead of ASCII string when talking about hex editor.
The segment you extracted was incomplete and will confuse H264 decoder or just be ignored.

BTW why do you do this? If you encode the file yourself why not save your cmdline to an separate file?

MatLz
29th November 2009, 16:29
It does work for me. Just follow I said.
The only problem is it doesn't show the correct bitrate in mediainfo if the stream isn't in a container.

And to answer to your question, take a look at my thread 'split a stats file', I ask for and say why.

MatLz
29th November 2009, 16:47
To also answer at your tone:
Prehistoric men had no idea about the process on how a baby can be made, but they made babies.

Guest
29th November 2009, 16:47
@MatLz

To do it properly you have to cut and paste the correct user data SEI. Since you say you don't know about SEIs, you can't be doing it properly.

roozhou
29th November 2009, 17:09
It does work for me. Just follow I said.
The only problem is it doesn't show the correct bitrate in mediainfo if the stream isn't in a container.

That means your bitstream is illegal. It plays fine on PC with libavcodec's H264 decoder, but it may crash with other decoders or devices(e.g. PSP).

MatLz
29th November 2009, 17:09
Ok ok I know nothing about SEIs...
I will post samples with my barbaric method, you will tell me what is wrong in. Thx

MatLz
29th November 2009, 17:36
Here is the link, sample from an old encode cuted and 'matlzredatated':devil:
http://www.sendspace.com/file/5wy8j0

Guest
29th November 2009, 17:42
I don't need to look at it. If you haven't properly cut on the required SEI boundaries, then you have mangled the stream. Don't you understand that?