View Full Version : Trimming R3D files?
Gavin Greenwalt
12-11-2007, 09:21 AM
Is there a way to just take snippets of an r3d file? Like 3 second clips?
Mark L. Pederson
12-11-2007, 09:24 AM
Is there a way to just take snippets of an r3d file? Like 3 second clips?
there is not YET a way to "truncate" .r3d files.
you can obviously export from IN and OUT from REDALERT/REDCINE/SCRATCH to TFF or DPX - but you can't make trimmed .r3d files ... YET.
Gavin Greenwalt
12-11-2007, 09:58 AM
What if I just used a hex editor and hacked roughly where I expect the important data to be.
Is there a "corrupted" R3D file fixer tool?
jbeale
12-11-2007, 10:05 AM
Since there is no inter-frame compression and frames are stored separately in the file, it should be an almost trivial job to make a R3D file splitter if you know the internal file layout, so you can get the header info correct. Right now, only a few people know those details and I think they're busy :-). But I'm sure that ability will be available eventually.
I don't know if Red will ever make their format details public, but even if they do, I understand why you would keep it closed until everything has stabilized, all camera features are enabled and have been found to work so that no incompatible changes to the R3D format internals are needed.
Stacey Spears
12-11-2007, 10:27 AM
If someone could create a one, two and three frame R3D file, then it might make it easy to figure out the bistream layout and build a cutting tool.
Of course, if the format is still subject to change, then it might be painful to keep reving the tool until they have stabilized.
Mark L. Pederson
12-11-2007, 10:28 AM
patience grasshoppers ....
Kevin Halverson
12-11-2007, 10:37 AM
What if I just used a hex editor and hacked roughly where I expect the important data to be.
Is there a "corrupted" R3D file fixer tool?
I asked this same question of some of the RED software guys awhile back and confirmed that there is only a header, no footer, so in theory, if you can find the frame deliminators, you could truncate the data at that point and have a limited number of frames. The problem might be any sample frame count markers in the header. Here you would need to know the file format to correct them. The last challenge is that .r3d files are compressed and so far, I have no idea as to the compression scheme(s) in use. A 'cut and extract' .r3d tool would be a great asset to have.
I devised a concept of a way to parse an .r3d file to look for these points. This requires that you have a known signal captured. The best approach that I came up with was to fully clip all three sensor channels (overexposed) and record a few seconds of this condition. Then assuming my concept is valid, you should have some repeating sequence that can be identified as a frame. This is a better approach than depriving the sensor of light as the quantizer noise should be swamped out. The only possible snag would be the compression approach. Despite being intra-frame, the compressor might assign a run length approach that might mask the frame boundaries.
Anyone else have any ideas as to an approach for this?
Gavin Greenwalt
12-11-2007, 10:37 AM
No patience.
Luckily I've already isolated the frame header data. So it's just a matter of writing a simple script now... problem solved.
There's a long series of 00 Hex values followed by REDV... a few Jpeg2k header disclaimers? and then the file metadata and the rest of the data.
Mark L. Pederson
12-11-2007, 10:52 AM
No patience.
Luckily I've already isolated the frame header data. So it's just a matter of writing a simple script now... problem solved.
There's a long series of 00 Hex values followed by REDV... a few Jpeg2k header disclaimers? and then the file metadata and the rest of the data.
be very careful of the "linked" multi-part .3rd files (you know, the ones over 2gig) - I am curious to see if you nail this with your mad-hacker skills ... I am a bit sceptical you will pull it off -
Jarred - I think we need a RED HACKS forum ....
Gavin Greenwalt
12-11-2007, 10:53 AM
baby steps... baby steps. :D
Jeff Kilgroe
12-11-2007, 11:18 AM
Gavin, I stumbled across this after my last PM to you... Heh. Are you already working on an R3D utility like I mentioned in the PM or thinking of doing one?
Mark L. Pederson
12-11-2007, 11:22 AM
Offhollywood is working on one that does various tricks.
Kevin Halverson
12-11-2007, 11:28 AM
Offhollywood is working on one that does various tricks.
I am very interested in a utility that could accomplish this. While I am much more a hardware guy (EE) than a software one (I do write machine code for DSPs, FPGAs and small micros) if there is anything that I can do to assist in this task, please feel free to contact me. If it could be command line driven, then a simple interface to an EDL would be a wonderful addition to allow for batch processing.
Kevin
Gavin Greenwalt
12-11-2007, 11:32 AM
My goal is to just write a simple command line application that does the following:
r3d.exe -extract -i "C:/Old.r3d" -s 20 -e 50 -o "C:/New.r3d"
But I'm still a ways off from that. For instance... I can't find the framerate in the metadata which makes timecode parsing tricky.
Problem is I'm more of a high-level problem solver. Code isn't really my thing either.
Mark L. Pederson
12-11-2007, 11:39 AM
I am very interested in a utility that could accomplish this. While I am much more a hardware guy (EE) than a software one (I do write machine code for DSPs, FPGAs and small micros) if there is anything that I can do to assist in this task, please feel free to contact me. If it could be command line driven, then a simple interface to an EDL would be a wonderful addition to allow for batch processing.
Kevin
I'll spill the beans on the features this weekend - need to make sure I'm not 100% insane -
Kevin Halverson
12-11-2007, 11:48 AM
"100% insane" - I think it is safe to say that anyone involved in this industry is certainly more than 0% insane and less than 100%. It is simply where, in this continuum, anyone falls that determines there level of functionality.
Seriously, thanks for any information that you can share.
Kevin
Gavin Greenwalt
12-11-2007, 11:48 AM
Hehe then I suppose you've already figured out:
0010 5C00 5245 4456 is the begining of each frame. ;) I look forward to your utility. Are you announcing what you hope it will do this weekend or are we getting working binaries?
laguun
12-11-2007, 12:57 PM
"100% insane" - I think it is safe to say that anyone involved in this industry is certainly more than 0% insane and less than 100%.
But to get to the top 101% are recommended :)
laguun
12-11-2007, 01:15 PM
My goal is to just write a simple command line application that does the following:
r3d.exe -extract -i "C:/Old.r3d" -s 20 -e 50 -o "C:/New.r3d"
Would be an quite helpful tool!
Curran Giddens
12-11-2007, 03:14 PM
0010 5C00 5245 4456
I have no idea what you guys are talking about, but I like how you made that fake quote by "Hex." Does this mean you use a hex editor to look at the .R3D code?
I don't speak "command line," what does this mean in english?
r3d.exe -extract -i "C:/Old.r3d" -s 20 -e 50 -o "C:/New.r3d"
Gavin Greenwalt
12-11-2007, 03:17 PM
Yeah I'm just using my trusty HexWorkshop v5 software which lets you explore the file as a hex file as well as an ASCII file simultaneously.
r3d.exe -extract -i "C:/Old.r3d" -s 20 -e 50 -o "C:/New.r3d" could mean anything but it uses a lot of standard conventions:
run r3d.exe (the application)
load the extract function.
the input file will be Old.r3d
extract frames 20 through 50 and...
output to New.r3d
Curran Giddens
12-11-2007, 03:18 PM
Yeah I'm just using my trusty HexWorkshop v5 software which lets you explore the file as a hex file as well as an ASCII file simultaneously.
r3d.exe -extract -i "C:/Old.r3d" -s 20 -e 50 -o "C:/New.r3d" could mean anything but it uses a lot of standard conventions:
run r3d.exe (the application)
load the extract function.
the input file will be Old.r3d
extract frames 20 through 50 and...
output to New.r3d
Ah, I see. That would be a quite handy indeed!
Bob England
12-11-2007, 03:46 PM
Hey, what's with this command line stuff? :mellow:
Why not a simple little GUI like Murdoc Cutter, my favorite little shareware MPEG2 Transport Stream Cutter:
http://www.myjavaserver.com/~itsadirect/M_cut.html
jbeale
12-11-2007, 03:52 PM
If you want to go exploring in binary files, one choice is "frhed" a free hex editor for Windows. http://www.kibria.de/frhed.html
Notice this R3D file contains times & dates in ASCII, and strings like "RED1", "ftypjp2", "Juno" and "LEXAR ATA FLASH CARD"
http://www.bealecorner.org/red/RED-R3D-HEX.png
Gavin Greenwalt
12-11-2007, 03:54 PM
Let's make the program before worrying about getting the user interface functional :D
I'm learning a new language in the process of writing it. Just be glad I'm not telling you to just do it through a hex editor!
Deanan
12-11-2007, 11:04 PM
At your own risk of course....
Chopping up r3d files is not trivial and if not done exactly right it will cause problems for r3d aware applications expecting a valid r3d file. The fileformat will continue to get some additions so it would be tough to support such a tool.
Mark L. Pederson
12-12-2007, 07:26 AM
At your own risk of course....
Chopping up r3d files is not trivial and if not done exactly right it will cause problems for r3d aware applications expecting a valid r3d file. The fileformat will continue to get some additions so it would be tough to support such a tool.
No risk ... No reward ...
here we go -
http://www.reduser.net/forum/showthread.php?p=120242#post120242
Gavin Greenwalt
12-12-2007, 10:54 AM
It's working! Sort of. It's about half manual, half automated but the script is alive! Changing it to match new header data would be like an hour of work.
jbeale
12-12-2007, 10:59 AM
Excellent news! (...what exactly does your script do?)
Gavin Greenwalt
12-12-2007, 11:06 AM
It takes frame or timecode i/o points and crops the file.
Right now though all it does is tell me where I need to crop in a hex editor (it's not doing the cropping itself yet) and then it requires me to do a single edit to the file to make it loadable by REDCine.
Unfortunately I've been really busy today and have been coding madly during renders but if I can find an hour or two somewhere soon I should be able to get it running 100% hands off.