mwturvey / pxl2000_Magic

9 stars 2 forks source link

Processing generates no PNG files #5

Open xpollen8 opened 5 years ago

xpollen8 commented 5 years ago

Occasionally, the java processing does not generate any usable output:

$ ./process.sh PXL_2_19890705_Ants_JuneChristy_Bike_Houses.wav
Processing: PXL_2_19890705_Ants_JuneChristy_Bike_Houses.wav..
Args are: 
    PXL_2_19890705_Ants_JuneChristy_Bike_Houses.wav
Making Directory PXL_2_19890705_Ants_JuneChristy_Bike_Houses
Performing FFT Pass.
Extracting PXL_2_19890705_Ants_JuneChristy_Bike_Houses/out.mp4..
ffmpeg version 2.8.3 Copyright (c) 2000-2015 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libvidstab --enable-vda
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
[image2 @ 0x7fe25b001200] Could find no file with path 'image%05d.png' and index in the range 0-4
image%05d.png: No such file or directory
Done!

Here is the contents of the directory after processing runs:

$ ls -la PXL_2_19890705_Ants_JuneChristy_Bike_Houses
total 879496
drwxr-xr-x   7 del  staff        238 Oct 13 19:27 .
drwxr-xr-x  36 del  staff       1224 Oct 13 19:05 ..
-rw-r--r--   1 del  staff   10535880 Oct 13 19:27 fft.csv
-rw-r--r--   1 del  staff  219043670 Oct 13 19:27 fft.wav
-rw-r--r--   1 del  staff     658890 Oct 13 19:27 raw_frames.csv
-rw-r--r--   1 del  staff  219043670 Oct 13 19:27 smoothed_fft.wav
-rw-r--r--   1 del  staff    1010217 Oct 13 19:27 syncs.csv
mwturvey commented 5 years ago

This would happen if no frames were detected. I'd guess one of three things is going on here-- 1) either the left and right channels are flipped 2) this isn't actually a PXL 2000 clip 3) there's some unusual corruption going on here.

I've experienced all 3. Can you open up the original .wav file in audacity, zoom in on a segment that's a couple seconds long, take a screen shot, and post it? That might help to understand what's going on.

mwturvey commented 5 years ago

... Or are you saying that given the same input, sometimes it works correctly, but sometimes it doesn't?

xpollen8 commented 5 years ago

Here's a grab of 3 seconds of signal from the file which didn't generate any PNGs.

3seconds

mwturvey commented 5 years ago

I just re-read your original comment--

-rw-r--r-- 1 del staff 658890 Oct 13 19:27 raw_frames.csv

Give the line above (and in particular, the fact that the file is very much non-zero in length), it clearly was able to parse out the various frames. It must have thrown an exception while running. Based on the files you have, it must have been when it was starting to generate the PNG's. I'll have to add some better error messaging to figure out what went wrong.

mwturvey commented 5 years ago

@xpollen8 I just committed a change that will re-throw an exception instead of suppressing it. Can you retry to see what output you get now? As a note, since the FFT is already calculated, it should re-use it instead of having to spend an potentially hours recalculating it.

mwturvey commented 5 years ago
Processing: PXL_2_19890705_2.wav..
Args are: 
    PXL_2_19890705_2.wav
Making Directory PXL_2_19890705_2
Performing FFT Pass.
Performing FFT Averaging Pass.
Performing Sync Finding Pass.
Performing Frame Finding Pass.
Drawing Frames.
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 6
    at pxlConverter.getPixels4(pxlConverter.java:655)
    at pxlConverter.drawFrames(pxlConverter.java:819)
    at Main.main(Main.java:53)

For this one, it appears that the original wav file is truncated. Can you try opening it in Audacity, exporting a new copy of the wav file, and retrying?

xpollen8 commented 5 years ago

Same outcome. When you say truncated, do you mean just obviously corrupt, or that leading/trailing frames may be incomplete?

This particular file is an excerpt from a full tape, and is 6 minutes in length.

Here is a zoomed-in example of the very start of the file - all looks good to me!

bad

This excerpt dies at:

Drawing Frames.
Figuring out where to use the sound.
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    at java.util.ArrayList.rangeCheck(ArrayList.java:653)
    at java.util.ArrayList.get(ArrayList.java:429)
    at pxlConverter.findValidSoundLocations(pxlConverter.java:919)
    at Main.main(Main.java:54)
mwturvey commented 5 years ago

This one looks a little different. It completed the step where it would have generated PNG files. I'm guessing you didn't get any?

Assuming you didn't get any frames, from your FFT output, it looks to me like the signals might be a little too low for it to have picked them up. You can check this by seeing if there's anything in raw_frames.csv. You could try opening up the FFT_Smoothed in Audacity, and amplify it ~4x (not sure what that is in db, but the idea is to raise up the low spikes.) Save the output with the same filename. Then, delete the following files: syncs.csv raw_frames.csv And finally re-run. If the low FFT spikes was the problem, this should fix it.

Of course, that all is a workaround. The application should at least give you a better error. I'll work on that.