a-schild / jave2

The JAVE (Java Audio Video Encoder) library is Java wrapper on the ffmpeg project
GNU General Public License v3.0
1.2k stars 245 forks source link

Cannot read FLAC file: InputFormatException #212

Closed louis-prudhomme closed 1 year ago

louis-prudhomme commented 2 years ago

Hi, I have been using jave2 for a bit to transcode music files to FLAC. I'm starting to fiddle with Opus, which prompted me to read FLAC files (instead of writing them).

However, we doing this with some of my FLACs, a InputFormatException is thrown when I invoke new MultimediaObject(path.toFile()).getInfo().getAudio().

(some logs were edited out for the sake of comprehension, as the program runs in parallel) ```log 15:10:54.169 [DEBUG @ parallel-10] w.s.j.p.f.DefaultFFMPEGLocator - Os name is isWindows: false isMac: true 15:10:54.169 [DEBUG @ parallel-10] w.s.j.p.f.DefaultFFMPEGLocator - Jave temp folder exists in 15:10:54.169 [DEBUG @ parallel-10] w.s.j.p.f.DefaultFFMPEGLocator - Executable path: /var/folders/lx/zfdpxh4944qghp5g10zjmvx40000gn/T/jave/ffmpeg-aarch64-3.1.1-osx 15:10:54.169 [DEBUG @ parallel-10] w.s.j.p.f.DefaultFFMPEGLocator - Executable exists in 15:10:54.182 [DEBUG @ parallel-10] w.s.j.p.f.DefaultFFMPEGLocator - ffmpeg executable found: /var/folders/lx/zfdpxh4944qghp5g10zjmvx40000gn/T/jave/ffmpeg-aarch64-3.1.1-osx 15:10:54.183 [DEBUG @ parallel-10] w.s.j.p.ProcessWrapper - About to execute /var/folders/lx/zfdpxh4944qghp5g10zjmvx40000gn/T/jave/ffmpeg-aarch64-3.1.1-osx -i /Users/louisprudhomme/Downloads/flacouzes/_-014 – They Want to Suck.flac -hide_banner 15:10:54.185 [DEBUG @ parallel-10] w.s.j.MultimediaObject - Output line: null Caused by: ws.schild.jave.InputFormatException: null at ws.schild.jave.MultimediaObject.parseMultimediaInfo(MultimediaObject.java:374) at ws.schild.jave.MultimediaObject.getInfo(MultimediaObject.java:165) at aofc.transcoder.Transcoder.apply(Transcoder.java:64) ... 12 common frames omitted ws.schild.jave.InputFormatException ```

I have tried to manually transcode one of the files with FFMPEG and it works (leading me to think the file is not corrupted). See here for the file.

```ksh ➜ Downloads ffmpeg -i input.flac -c:a libvorbis -b:a 320k -ar 48000 output.ogg -y ffmpeg version 5.0.1 Copyright (c) 2000-2022 the FFmpeg developers built with Apple clang version 13.1.6 (clang-1316.0.21.2) configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.0.1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon libavutil 57. 17.100 / 57. 17.100 libavcodec 59. 18.100 / 59. 18.100 libavformat 59. 16.100 / 59. 16.100 libavdevice 59. 4.100 / 59. 4.100 libavfilter 8. 24.100 / 8. 24.100 libswscale 6. 4.100 / 6. 4.100 libswresample 4. 3.100 / 4. 3.100 libpostproc 56. 3.100 / 56. 3.100 Input #0, flac, from 'input.flac': Metadata: TITLE : Bring to the Boil ARTIST : Beltaine ALBUM ARTIST : Various Artists album_artist : Various Artists ALBUM : The Witcher: Music Inspired by the Game track : 10 GENRE : Game Score;Score DATE : 2007 ENSEMBLE : Various Artists Duration: 00:04:35.56, start: 0.000000, bitrate: 1062 kb/s Stream #0:0: Audio: flac, 44100 Hz, stereo, s16 Stream #0:1: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 500x500 [SAR 100:100 DAR 1:1], 90k tbr, 90k tbn (attached pic) Metadata: comment : Cover (front) Stream mapping: Stream #0:1 -> #0:0 (mjpeg (native) -> theora (libtheora)) Stream #0:0 -> #0:1 (flac (native) -> vorbis (libvorbis)) Press [q] to stop, [?] for help [swscaler @ 0x148008000] [swscaler @ 0x148018000] deprecated pixel format used, make sure you did set range correctly [swscaler @ 0x148008000] [swscaler @ 0x148028000] deprecated pixel format used, make sure you did set range correctly [swscaler @ 0x148008000] [swscaler @ 0x148038000] deprecated pixel format used, make sure you did set range correctly [swscaler @ 0x148008000] [swscaler @ 0x148048000] deprecated pixel format used, make sure you did set range correctly [swscaler @ 0x148008000] [swscaler @ 0x148058000] deprecated pixel format used, make sure you did set range correctly [swscaler @ 0x148008000] [swscaler @ 0x148068000] deprecated pixel format used, make sure you did set range correctly [swscaler @ 0x148008000] [swscaler @ 0x148078000] deprecated pixel format used, make sure you did set range correctly [swscaler @ 0x148008000] [swscaler @ 0x148088000] deprecated pixel format used, make sure you did set range correctly [swscaler @ 0x148008000] [swscaler @ 0x148098000] deprecated pixel format used, make sure you did set range correctly [swscaler @ 0x148008000] [swscaler @ 0x1480a8000] deprecated pixel format used, make sure you did set range correctly [swscaler @ 0x148008000] [swscaler @ 0x1480b8000] deprecated pixel format used, make sure you did set range correctly [ogg @ 0x151e071d0] Frame rate very high for a muxer not efficiently supporting it. Please consider specifying a lower framerate, a different muxer or -vsync 2 Output #0, ogg, to 'output.ogg': Metadata: TITLE : Bring to the Boil ARTIST : Beltaine ALBUM ARTIST : Various Artists album_artist : Various Artists ALBUM : The Witcher: Music Inspired by the Game track : 10 GENRE : Game Score;Score DATE : 2007 ENSEMBLE : Various Artists encoder : Lavf59.16.100 Stream #0:0: Video: theora, yuv420p(tv, bt470bg/unknown/unknown, progressive), 500x500 [SAR 1:1 DAR 1:1], q=2-31, 200 kb/s, 90k fps, 90k tbn (attached pic) Metadata: DESCRIPTION : Cover (front) encoder : Lavc59.18.100 libtheora TITLE : Bring to the Boil ARTIST : Beltaine ALBUM ARTIST : Various Artists ALBUMARTIST : Various Artists ALBUM : The Witcher: Music Inspired by the Game TRACKNUMBER : 10 GENRE : Game Score;Score DATE : 2007 ENSEMBLE : Various Artists Stream #0:1: Audio: vorbis, 48000 Hz, stereo, fltp, 320 kb/s Metadata: encoder : Lavc59.18.100 libvorbis TITLE : Bring to the Boil ARTIST : Beltaine ALBUM ARTIST : Various Artists ALBUMARTIST : Various Artists ALBUM : The Witcher: Music Inspired by the Game TRACKNUMBER : 10 GENRE : Game Score;Score DATE : 2007 ENSEMBLE : Various Artists frame= 1 fps=0.3 q=-0.0 Lsize= 13050kB time=00:04:35.55 bitrate= 388.0kbits/s speed=93.7x video:5kB audio:12960kB subtitle:0kB other streams:0kB global headers:7kB muxing overhead: 0.656630% ➜ Downloads mpv output.ogg (+) Video --vid=1 'Bring to the Boil' (theora 500x500) (+) Audio --aid=1 'Bring to the Boil' (vorbis 2ch 48000Hz) AO: [coreaudio] 48000Hz stereo 2ch floatp VO: [libmpv] 500x500 yuv420p AV: 00:00:03 / 00:04:35 (1%) Exiting... (Quit) ```

Would you have any idea of what I could be doing wrong ? Thanks !

louis-prudhomme commented 1 year ago

Music file was badly formatted.