Unable to parse MP4 files -MemoryAllocationException: Tried to allocate X bytes, but the limit for this record type is:Y - metadata

I am using Tika server to fetch metadata and contents of various file formats. I am using server with fileUrl enabled.
When parsing .mov file which are created using quicktime screen record, it gives me the following error.
Text extraction failed (null) org.apache.tika.exception.TikaException:
Unexpected RuntimeException from
org.apache.tika.parser.mp4.MP4Parser#354bc1a2 at
org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:293)
at
org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280)
Caused by: org.mp4parser.MemoryAllocationException: Tried to allocate
1399026269 bytes, but the limit for this record type is: 536870912. If
you believe this file is not corrupt, please open a ticket on github
to increase the maximum allowable size for this record type. at
org.mp4parser.tools.MemoryUtils.allocateByteBuffer(MemoryUtils.java:30)
at org.mp4parser.support.AbstractBox.parse(AbstractBox.java:100) at
org.mp4parser.AbstractBoxParser.parseBox(AbstractBoxParser.java:115)
The size of the file is just 20Mb. Other type of .mov files with
content-type="video/quicktime"
is getting parsed with out any error. I connected the debug port and i see that it fails when converting to new IsoFile().
Any help to fix this is highly appreciated.
I start the server as shown below.
java -jar tikaserver-1.24.1.jar -enableFileUrl -enableUnsecureFeatures

Related

scipy.io.wavfile.read() fails to read ffmpeg-python's output

I followed the top answer in this StackOverflow post to use ffmpeg-python extract a .wav file from a YouTube URL (into the pcm_s16le codec), which was played successfully by my local audio player (Mac's Music).
However, as I tried to read it using scipy.io's wavefile,
samplerate, data = wavfile.read(wav_fname)
the following error message is thrown:
"WavFileWarning: Reached EOF prematurely; finished at 1192015 bytes, expected 4294967303 bytes from header."
May anyone suggest what's going on?
I have successfully extracted a .wav file which is successfully read by my local music player. However, it is failed to be recognized by scipy.io's wavefile. And I am not sure why.

ffprobe Error "Could not find codec parameters..."

My MP4 file issue is a bit complicated, so I have created a very simple scenario to help me diagnose it step by step.
I can create a working MP4 file that works flawlessly. The following is its structure shown by Mp4Explorer:
For debugging purpose, I removed the media data box mdat, and al stts, stsz,stss, stsc, stco boxes and kept everything else the same. This means the MP4 file has no media data. It just has some metadata.
This file is named error.mp4. If I run:
ffprobe "error.mp4"
I get the following error:
[mov,mp4,m4a,3gp,3g2,mj2 # 00000286e763ef00] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 1280x800): unspecified pixel format
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Could anyone shed some light on this error? Why is it "Could not find codec parameters for stream 0"? If I remove the video track and leave the audio track as is, ffprobe will be happy with no errors.

Read DNG file in Matlab

I am trying to read dng files from iphoneX.
I read the link https://blogs.mathworks.com/steve/2011/03/08/tips-for-reading-a-camera-raw-file-into-matlab/
But the error message is 'Reference to non-existent field 'SubIFDs'.'
info=imfinfo(dng_file_path);
info.SubIFDs{1} %where the error pop up
tiffHandle=Tiff((dng_file_path),'r');
offsets=TiffHandle.getTag('SubIFD');
setSubDirectory(TiffHandle,offsets(1));
CFA=double(read(TiffHandle));
The DNG files from iphone seem to be compressed (lossless jpeg compression). Try running the file through DNG Converter with the preferences set to Uncompressed. Then try that in Matlab.

Truezip returning unsupported compression method error when extracting large files

Truezip 6 and 7 returning error message "compression method 9 is not supported" when extracting any files greater then 2GB that were compressed using windows compressing method.
(This is achieve by highlighting the file that is 2GB or bigger and then right clicking on the mouse -> send to->Compressed (zipped) folder).
using Truezip 7 code below:
TFile srcFile = new TFile(src, incPath);
TFile dstFile = new TFile(dst);
TFile.cp_rp(srcFile, dstFile, TArchiveDetector.NULL);
produces the error "compression method 9 is not supported" when it hits the "..truezip.zip.RawZipFile.getInputStream". Is there a way to fix this? or a method to overcome this issue?
This only happens when using windows zipped method, however when using 7Zip to compress files that is greater then 2GB and then using truezip to extract isn't a problem.
Method 9 is an extended Deflater method with a bigger dictionary. As the exception says, it isn't supported because the JRE doesn't support it. It seems to be new that the Windows Explorer is using this method.

RTSP Source Filter with GDCL MP4 Muxer incompatibility

I'm trying to use GDCL MP4 Muxer with my RTSP Source Filter. They work fine together except after stopping the graph, muxer doesn't finilize the file and write the reqiured tables to the end of file via file writer (some parts are written starting from moov but not the time table values). When I try another RTSP source filter (which I don't have its source codes), table values are created with GDCL MP4 Muxer.
But when I try Elecard's MP4 Muxer, it works fine with my RTSP Source Filter. So, there is an incompatibility. I examined GDCL's source codes but couldn't find what it was expecting from me. I already calculate and set timestamp values to samples using SetTime method. But GDCL still doesn't finilaze file. Is it caused by missing information or missing signal when graph stops? What can be the problem, any ideas?
One thing you should be aware of regarding Geraint's MP4 Mux is that it is checking incoming media samples to have both start and stop time. You might be having only .tStart/AM_SAMPLE_TIMEVALID which still makes sense for video, but this would be a problem.
So the samples have to have stop time, or you need to fix this in multiplexer code.
A typical symptom for the problem is that generated files are empty or of zero duration.