Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FFprobeKit output is not as expected, no matter what the commands and files are #531

Closed
tasy5kg opened this issue Aug 11, 2022 · 8 comments
Assignees
Labels
all-platforms bug Something isn't working fixed-in-v5.1 library Affects the library v4.5.1 Affects v4.5.1 release

Comments

@tasy5kg
Copy link

tasy5kg commented Aug 11, 2022

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
@tanersener
Copy link
Collaborator

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 tanersener added question Further information is requested android Affect Android platform library Affects the library v4.5.1 Affects v4.5.1 release labels Aug 11, 2022
@tasy5kg
Copy link
Author

tasy5kg commented Aug 11, 2022

@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:

Screenshot_2022-08-12-03-02-04-488_com arthenica


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

Screenshot_2022-08-12-02-47-04-727_com termux-edi

@tasy5kg
Copy link
Author

tasy5kg commented Aug 11, 2022

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.

Screenshot_2022-08-12-03-13-33-450_com arthenica

@tanersener
Copy link
Collaborator

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.

@tasy5kg
Copy link
Author

tasy5kg commented Aug 11, 2022

@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

  1. open the test-app
  2. execute the FFprobe command directly in the COMMAND menu

you can get the correct result like this screen record:

correct.mp4

If you

  1. open the test-app
  2. switch to SAF menu
  3. click RUN FFPROBE
  4. select any media file
  5. get result
  6. back to COMMAND menu
  7. 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:

bug.mp4

This issue is reproducible on physical and virtual machines. Test on API 26 x86_64 and API 32 arm64-v8a.

@tanersener
Copy link
Collaborator

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.

@tanersener tanersener added bug Something isn't working needs-analysis We don't know that this is. It must be investigated further and removed question Further information is requested labels Aug 11, 2022
@ArtiomYak
Copy link

Yes there bug in android 12+

@tanersener tanersener self-assigned this Aug 25, 2022
@tanersener tanersener added apple Affect Apple platforms linux Affects linux platform all-platforms fixed-on-development Fixed on the development branch. Not released yet. and removed needs-analysis We don't know that this is. It must be investigated further linux Affects linux platform android Affect Android platform apple Affect Apple platforms labels Aug 25, 2022
@tanersener
Copy link
Collaborator

tanersener commented Aug 25, 2022

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.

@tanersener tanersener removed the fixed-on-development Fixed on the development branch. Not released yet. label Oct 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
all-platforms bug Something isn't working fixed-in-v5.1 library Affects the library v4.5.1 Affects v4.5.1 release
Projects
None yet
Development

No branches or pull requests

3 participants