tanersener / mobile-ffmpeg

FFmpeg for Android, iOS and tvOS. Not maintained anymore. Superseded by FFmpegKit.
https://tanersener.github.io/mobile-ffmpeg
GNU General Public License v3.0
3.85k stars 787 forks source link

Random Error Using FFprobe.getMediaInformation #692

Closed buntupana closed 3 years ago

buntupana commented 3 years ago

Description When I try to retrieve info using FFprobe.getMediaInformation sometimes I'm getting an error, I think this just happen when I have a encoding process ongoing with FFmpeg.

Expected behavior Get result without errors

Current behavior Getting random errors when FFmpeg encoding is ongoing

Logs

    E/mobile-ffmpeg:         "filename": "/data/user/0/com.example.androidapp/files/test/1615194230597.mp4",
        "nb_streams": 2,
        "nb_programs": 0,
        "format_name": "mov,mp4,m4a,3gp,3g2,mj2",
        "start_time": "0.000000",
        "duration": "0.952000",
        "size": "66902",
        "bit_rate": "562201",
        "probe_score": 100,
        "tags": {
            "major_brand": "mp42",
            "minor_version": "0",
            "compatible_brands": "isommp42",
            "creation_time": "2021-03-08T09:03:52.000000Z",
            "com.android.version": "11"
        }

    at org.json.JSONTokener.syntaxError(JSONTokener.java:460)
    at org.json.JSONTokener.readObject(JSONTokener.java:403)
    at org.json.JSONTokener.nextValue(JSONTokener.java:104)
    at org.json.JSONObject.<init>(JSONObject.java:165)
    at org.json.JSONObject.<init>(JSONObject.java:182)
    at com.arthenica.mobileffmpeg.MediaInformationParser.fromWithError(MediaInformationParser.java:61)
    at com.arthenica.mobileffmpeg.MediaInformationParser.from(MediaInformationParser.java:45)
    at com.arthenica.mobileffmpeg.FFprobe.getMediaInformationFromCommandArguments(FFprobe.java:126)
    at com.arthenica.mobileffmpeg.FFprobe.getMediaInformation(FFprobe.java:86)

Environment

tanersener commented 3 years ago

Yeah, FFprobe FFprobe.getMediaInformation() in mobile-ffmpeg does not support running multiple (FFmpeg/FFprobe) commands in parallel. I suggest you try ffmpeg-kit to do that. FFprobe FFprobeKit.getMediaInformation() implemented there supports concurrent executions.

buntupana commented 3 years ago

I thought that parallel execution was supported

link

tanersener commented 3 years ago

Let me rephrase that.

As the documentation in that link says, concurrent command execution in FFprobe is implemented in v4.3.1. And it works for FFprobe commands. But:

  1. You're using getMediaInformation which is a custom implementation of FFprobe commands and this method does not support that. The javadoc of this method clearly states that concurrent execution is not supported. You can see it here.

  2. Secondly, there is a bug discovered about FFprobe regarding logs and it is fixed on ffmpeg-kit. I don't know if it affects this issue but it is there.