bramp / ffmpeg-cli-wrapper

Java wrapper around the FFmpeg command line tool
BSD 2-Clause "Simplified" License
1.72k stars 413 forks source link

NumberFormatException from Gson decoder #331

Closed Vshnv closed 4 months ago

Vshnv commented 4 months ago

Describe the bug Type of id in Chapters is currently set to int. When probing the sample open sintel movie, Im getting a NumberFormatException as the value is in the long range.

    at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:251)
    at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:241)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.readIntoField(ReflectiveTypeAdapterFactory.java:212)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$FieldReflectionAdapter.readField(ReflectiveTypeAdapterFactory.java:433)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:393)
    at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.readIntoField(ReflectiveTypeAdapterFactory.java:212)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$FieldReflectionAdapter.readField(ReflectiveTypeAdapterFactory.java:433)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:393)
    at com.google.gson.Gson.fromJson(Gson.java:1227)
    at com.google.gson.Gson.fromJson(Gson.java:1137)
    at com.google.gson.Gson.fromJson(Gson.java:1075)
    at net.bramp.ffmpeg.FFprobe.probe(FFprobe.java:110)
    at net.bramp.ffmpeg.FFprobe.probe(FFprobe.java:47)
    at FFProbeMediaMetaProvider.fetchMediaMeta(FFProbeMediaMetaProvider.kt:6)
    at MainKt.main(Main.kt:2)
Caused by: java.lang.NumberFormatException: Expected an int but was 3252980857 at line 498 column 29 path $.chapters[1].id
    at com.google.gson.stream.JsonReader.nextInt(JsonReader.java:1186)
    at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:249)
    ... 17 more```

**To Reproduce**
The movie is free to download to test encoders and stuff I believe. You can find it on blender's website here: https://durian.blender.org/download/
```java
val probe = FFprobe()
val result = probe.probe(inputPath)
System.out.println(result)

Expected behavior Expected is for it to parse the chapters data properly or allow us to select what part of meta we want to fetch so even if there is a bug as such we can narrow the probe to something specific (for eg. just streams).

bramp commented 4 months ago

This should be fixed by https://github.com/bramp/ffmpeg-cli-wrapper/commit/bb52097e600338a1a3ff3b264f0445fb85f1ed38 . I just haven't released a new version yet

Vshnv commented 4 months ago

Oh, yes. Thank you!