ffmpeg-kit
ffmpeg-kit copied to clipboard
FFprobeKit output is not as expected, no matter what the commands and files are
Description
FFprobeKit.execute(command).getOutput()
result is not as expected, no matter what the commands and files are.
To Reproduce
Sometimes I want to get media properties with FFprobe commands. As sample scripts mentioned on https://trac.ffmpeg.org/wiki/FFprobeTips ,
to get the format duration:
ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 input.mp4
It should just return something like 30.024000
, and I got similar results when using the FFmpeg command line tool on my computer.
But when I try to execute it in FFprobeKit
:
FFprobeKit.execute("-v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "+path).getOutput()
It always returns something like this:
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
und
VideoHandler
[0][0][0][0]
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
und
SoundHandler
[0][0][0][0]
38.058000
isom
512
isomiso2avc1mp41
Lavf58.45.100
Another example:
To get frame rate, without formatted:
ffprobe -v error -select_streams v:0 -show_entries stream=avg_frame_rate input.mp4
When using the FFmpeg command line tool on my computer, it should return something like this:
[STREAM]
avg_frame_rate=32835/569
[/STREAM]
Execute it in FFprobeKit
:
FFprobeKit.execute("-v error -select_streams v:0 -show_entries stream=avg_frame_rate "+path).getOutput()
returns:
[STREAM]
avg_frame_rate=32835/569
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
DISPOSITION:captions=0
DISPOSITION:descriptions=0
DISPOSITION:metadata=0
DISPOSITION:dependent=0
DISPOSITION:still_image=0
TAG:language=und
TAG:handler_name=VideoHandler
TAG:vendor_id=[0][0][0][0]
[/STREAM]
[FORMAT]
TAG:major_brand=isom
TAG:minor_version=512
TAG:compatible_brands=isomiso2avc1mp41
TAG:encoder=Lavf58.45.100
[/FORMAT]
It seems these strange outputs are returned regardless of the command and file.
Expected behavior
Returns consistent results with command line tools.
Environment
- Platform:
Android 12
- Architecture:
arm64-v8a
- Version:
com.arthenica:ffmpeg-kit-min:4.5.1-1
- Android Studio version:
2021.2.1 Patch 2
I don't see this issue in the current test applications we have under ffmpeg-kit-test. They all work as expected.
Consider providing detailed instructions to reproduce this if you need help.
@tanersener ,Hello.
I have cloned ffmpeg-kit-test/android to local and built test-app-maven-central
. The same issue has been reproduced.
~~Update: There is no problem with the source code. I didn't download the SDK tools 30 version, so I changed the compileSdkVersion
from 30
to 32
, which caused this problem.~~
Update: This is still not the right reason. Please check out later posts. Sorry for the misunderstanding.
Environment
- Platform:
Android 12 (Physical device)
- Architecture:
arm64-v8a
- Android Studio version:
2021.2.1 Patch 2
-
compileSdkVersion
:32
- Sample video: 20220811_114433_500.mp4 (4.96 MB)
In test-app-maven-central
Input command:
-v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 /storage/emulated/0/Download/20220811_114433_500.mp4
Then click RUN FFPROBE, result:
In shell (expected behavior)
Input command:
ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 /storage/emulated/0/Download/20220811_114433_500.mp4
Result:
15.240000
~~Maybe I found the reason... When switching compileSdkVersion
from 32
to 30
it returned the correct result.~~
Update: This is still not the right reason. Please check out later posts. Sorry for the misunderstanding.
Does this occur on emulators?
None of my physical devices are on Android 12. I tested this on an arm64
Android 12 emulator. But didn't see any problems on it.
@tanersener , I went ahead and tried a few things and found that the issue is not related to the SDK version.
Seems to be an issue with SAF.
The following operation runs ffmpeg-kit-test/android/test-app-maven-central
without modifying compileSdkVersion
or any other code.
If you
- open the test-app
- execute the FFprobe command directly in the
COMMAND
menu
you can get the correct result like this screen record:
https://user-images.githubusercontent.com/30869777/184234897-bcbcd691-a1d4-43cd-8d50-bd7980b37146.mp4
If you
- open the test-app
- switch to
SAF
menu - click
RUN FFPROBE
- select any media file
- get result
- back to
COMMAND
menu - input FFprobe command below
-v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 /storage/emulated/0/Download/20220811_114433_500.mp4
you will get unexpected result like this screen record:
https://user-images.githubusercontent.com/30869777/184235783-5af75914-04a6-4536-9501-92db83e5579f.mp4
This issue is reproducible on physical and virtual machines. Test on API 26 x86_64
and API 32 arm64-v8a
.
Thanks. I managed to reproduce it using the instructions in the latest post.
We need to debug & analyse this to understand why it is happening.
Yes there bug in android 12+
My tests show that this bug doesn't originate from saf
. It is a generic issue about ffprobe
. It affects ffprobe
on all platforms.
I fixed it on the development branch. The fix will be included in the next release which I'm working on.