to save time and not having to re-encode it again with the procedure kindly suggested (and correct functioning) by poison using ffmpeg
I supposed to be a cats play but it's very very difficult, almost impossible to add a initial timecode code into a virtualdub mjpeg .avi file...
I have see in another case (ffmpeg, matrox digisuite .avi files ecc..) timecode code in "envelope" in the header of the .avi, I thought that somehow, using hex editor you could (in an automated way then) enter the timecode but now I have lost hope
Is there a solution?
+ Reply to Thread
Results 1 to 14 of 14
Unless you want to know where to change any code bits easily then no.I think,therefore i am a hamster.
ffmpeg -i c0020.mxf -f ffmetadata metadata.txt
ffmpeg -y -i c0020.avi -i metadata.txt -map_metadata 1 -vcodec copy -an -vtag MJPG c0020a.avi
However, I fear that the file must be rewritten all in any case and that the time required will look like the same procedure with ffmpeg.
of course the best thing would be that virtualdub has a proper wraps timecode during the encoding process ... but it is not, unfortunately
It cannot be done easily because each 'chunk' of the AVI has a byte count (4 bytes) following the chunk name. To make it even worse, some chunks have a major chunk that encompasses several others and the byte count for it includes the sub chunks. Notice 'tdat' chunk including 'tc_0', 'tc_a', 'rn_0' and 'rn_a'. This is similar to MP4 file 'Atoms' structure.
If the correct chunk (ISMP) was included and you just wanted to CHANGE the date/time then yes, it could be done, but if you are trying to add it, the whole file would need rewritten, at least the byte counts and that would be easier to have an existing program do that for you.
like everyone has said, you will have to rebuild the avi.
but i'm still not sure what you are trying to do here.
a) you want to insert a timecode inside the actual avi ?
b) you want to inserf many timecodes throughout the whole avi ?
c) you just want to have the timecode (length) reported inside the avi once ?
Adding info (as opposed to changing something that's already there -- like the fourcc) to an AVI file with a hex editor is impractical. The RIFF structure contains many nested size and offset pointers that need to be modified to account for the new sizes and positions of data. That's a non-trivial task and requires intimate knowledge of the RIFF structure.
So I would like to have a timecode into the .avi (generated by virtualdub) but considering that virtualdub does not include minimally a timecode structure inside the .avi file
well, there may be a few alternative ways to view timecodes for your videos.
followup question...what could you possibly gain from having it embeded in the avi if all you need is to just see the timecode ? what are you trying to do with the timecode inside the avi ?
actually, you can see the times inside virtual's timeline. consider that every frame has a time code, depending on the frame rate and Ás per frame. for example: 29.970 is 33367Ás, 25.00 is 40000Ás, and so on. i wrote a utility to calculate and show timecodes based on Frame Number and Frame Rate, using a slidescale or entering the frame number because i thought it could be useful in something like subtitle text work and whatnot, but other than that, i could not find any other good use for it. it was educational to figure out how to do it.
To add ISMP or IDIT chunks you might be able to overwrite the JUNK chunk (it's just padding to align later chunks on 1K or 4K boundaries) that usually follows the STRL chunk. Rename the chunk ISMP, leave the length intact, write the date/time data in the body of the chunk. Since ISMP and IDIT are null terminated ascii strings it shouldn't matter that there's a lot of extra nulls following the date/time. I don't know what programs report that data so I can't test it.
Last edited by jagabo; 27th Apr 2014 at 22:36.
FFMPEG have timecode, but I cannot use it because it generate wrong .avi mjpeg files... at least as regards what I should do.
Mjpeg .avi files generated from ffmpeg are not open by virtualdub with it's internal .mjpeg decompressor, and are not openable by my nle (in sync speed razor). Only if I swith in speed razor the RGB24bit project mode, files are openable but results jerky playback... so files generated by ffmpeg, for me, can not be managed.
Virtualdub generate .avi mjpeg files alwais ok
Hi again, so now with this enhancement I can add timecode to a .avi file
can I found a dos program that can change hex values so this, in a .avi file?
I'm looking for an application that can change the .avi header, possibly without rewrite the entire .avi file? and possibly I would like copy the timecode data from a file and put to the destination file