Android 上的 FFProbe 输出
FFMProbe Output on Android
如何在FFMPegKit上执行并获取FFMProbe命令的输出?我尝试了各种方法。但是我失败了。谁能帮帮我?
过了几天我成功了(虽然问答时间是一样的,但是我试的比较早)
FFprobeKit.executeAsync("-v error -show_streams -print_format json videopath") { session ->
Log.d("TAG", "fileDetails: FMProbe output: ${session?.output}")
}
此 Log.d 将输入视频的详细信息打印为 JSON(作为命令)。
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]"
}
}
]
}
如何在FFMPegKit上执行并获取FFMProbe命令的输出?我尝试了各种方法。但是我失败了。谁能帮帮我?
过了几天我成功了(虽然问答时间是一样的,但是我试的比较早)
FFprobeKit.executeAsync("-v error -show_streams -print_format json videopath") { session ->
Log.d("TAG", "fileDetails: FMProbe output: ${session?.output}")
}
此 Log.d 将输入视频的详细信息打印为 JSON(作为命令)。
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]"
}
}
]
}