|
Introduction
------------
I have encounterd too many erroneous real media files, for a long time I search rm fixing
tools on the web, but the fixed result are not always good.
Finally when I found RealMedia File Format Reference, I decided to
make such a tool by myself.
Read and Write real media files
-------------------------------
The RealMedia File Format is defined in the Format.xml file. It is deserialized into
a Format object, which contain RecordDefs and FieldDefs.
Then some generalize methods are used to read and write real media files according to its
format definition.
Check and Fix Errors
--------------------
There are some common errors in a real media file.
Problem: Some portion of the file can't be played.
Cause: There are bad packets in the DATA chunk.
Symptom: There are decoding errors.
Cause: The DATA chunk's Size value is not correct.
Symptom: The chunk that follow DATA chunk is not an INDX chunk.
Cause: The DATA chunk's num_packets value is not correct.
Symptom: DATA chunk's size value and calculated size mismatch.
Fix: Recover all media packets.
Problem: Player can't seek in the file.
Cause: The INDX chunks are corrupted or nonexistent.
Symptom: The number of INDX chunks is less than the numbers of MDPR chunks.
Fix: Rebuild index chunks.
The operations also applys to rmvb files.
The Alorithm of Recover all media packets
-----------------------------------------
pseudo code:
read a packet
if(the packet is good)
{
collect the packet
}
else
{
remember the bad point
find synchronized points using INDX chunks
backtrack to some recoverable point
search packets between bad point and recoverable point
go on read from recoverable point
}
History
-------
2006-11-17
Load and list chunks and theirs fields.
2006-11-18
Load and list media packets and index records.
2006-11-19
Check and fix errors.
2006-11-20
Show MDPR chunk's type_specific_data.
Cut out a portion of the media file. Not perfect, need help.
2006-11-21
Fixed some bugs.
2006-11-22
Recover all media packets.
2006-11-23
Improved the efficiency of backtracking in recovery.
Search packets in corrupted area to recover more.
2006-11-25
Remove dummy packets.
Search packets if synchronized point is not found.
2006-12-23
Read packets only when needed, open file is now fast.
Recover Index Chunk before recover packets.
2007-01-04
Use temporary file to store recovered packets, memory usage is greatly reduced.
Using the following steps:
1)Recover all packets
2)Remove invalid chunks if there are
3)Rebuild index chunks,
it is possible to give a maximum fix for all fixable real media files.
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.