Search code examples
androidandroid-ffmpeg

FFMProbe Output on Android


How to execute and get the output of the FFMProbe command on FFMPegKit? I tried various ways. But I failed. Can anyone help me, please?


Solution

  • After a few days later I got success (though the Question and answer time is same. But I tried it earlier more).

    FFprobeKit.executeAsync("-v error -show_streams -print_format json videopath") { session ->
            Log.d("TAG", "fileDetails: FMProbe output: ${session?.output}")
        }
    

    This Log.d print the details of inputted video as a JSON (as the command).

    FFMProbe output: {
        "streams": [
            {
                "index": 0,
                "codec_name": "h264",
                "codec_long_name": "unknown",
                "profile": "100",
                "codec_type": "video",
                "codec_time_base": "1/60",
                "codec_tag_string": "avc1",
                "codec_tag": "0x31637661",
                "width": 1920,
                "height": 1080,
                "coded_width": 1920,
                "coded_height": 1088,
                "closed_captions": 0,
                "has_b_frames": 1,
                "sample_aspect_ratio": "1:1",
                "display_aspect_ratio": "16:9",
                "pix_fmt": "yuv420p",
                "level": 40,
                "color_range": "tv",
                "color_space": "bt709",
                "color_transfer": "bt709",
                "color_primaries": "bt709",
                "chroma_location": "left",
                "refs": 1,
                "is_avc": "true",
                "nal_length_size": "4",
                "r_frame_rate": "30/1",
                "avg_frame_rate": "30/1",
                "time_base": "1/15360",
                "start_pts": 0,
                "start_time": "0.000000",
                "duration_ts": 3329024,
                "duration": "216.733333",
                "bit_rate": "1461827",
                "bits_per_raw_sample": "8",
                "nb_frames": "6502",
                "disposition": {
                    "default": 1,
                    "dub": 0,
                    "original": 0,
                    "comment": 0,
                    "lyrics": 0,
                    "karaoke": 0,
                    "forced": 0,
                    "hearing_impaired": 0,
                    "visual_impaired": 0,
                    "clean_effects": 0,
                    "attached_pic": 0,
                    "timed_thumbnails": 0
                },
                "tags": {
                    "language": "und",
                    "handler_name": "ISO Media file produced by Google Inc.",
                    "vendor_id": "[0][0][0][0]"
                }
            },
            {
                "index": 1,
                "codec_name": "aac",
                "codec_long_name": "unknown",
                "profile": "1",
                "codec_type": "audio",
                "codec_time_base": "1/44100",
                "codec_tag_string": "mp4a",
                "codec_tag": "0x6134706d",
                "sample_fmt": "fltp",
                "sample_rate": "44100",
                "channels": 2,
                "channel_layout": "stereo",
                "bits_per_sample": 0,
                "r_frame_rate": "0/0",
                "avg_frame_rate": "0/0",
                "time_base": "1/44100",
                "start_pts": 0,
                "start_time": "0.000000",
                "duration_ts": 9561088,
                "duration": "216.804717",
                "bit_rate": "127999",
                "max_bit_rate": "127999",
                "nb_frames": "9337",
                "disposition": {
                    "default": 1,
                    "dub": 0,
                    "original": 0,
                    "comment": 0,
                    "lyrics": 0,
                    "karaoke": 0,
                    "forced": 0,
                    "hearing_impaired": 0,
                    "visual_impaired": 0,
                    "clean_effects": 0,
                    "attached_pic": 0,
                    "timed_thumbnails": 0
                },
                "tags": {
                    "language": "und",
                    "handler_name": "ISO Media file produced by Google Inc.",
                    "vendor_id": "[0][0][0][0]"
                }
            }
        ]
    }