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

FFprobe.getMediaInformation return null , Any alternate solution is available for get media information? #604

Closed AxitaKathiriya closed 3 years ago

AxitaKathiriya commented 3 years ago

Description FFprobe.getMediaInformation() return null and Android App crash when i try to get media duration. Any alternate solution is available for getting media information?

Expected behavior I want to get media Information. Each and every time i want to get information of any media file instead of null.

Current behavior Sometime FFprobe.getMediaInformation() return null and Android App crashes.

Screenshots Capture

Logs I/mobile-ffmpeg: Loading mobile-ffmpeg. I/mobile-ffmpeg: Loaded mobile-ffmpeg-full-arm-v7a-neon-4.4-lts-20200803. W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.arthenica.mobileffmpeg.MediaInformation.getDuration()' on a null object reference

Environment

AxitaKathiriya commented 3 years ago

Please check @tanersener.. I have updated issue according to your issue-template format. And please give me alternate solution. Thanks

tanersener commented 3 years ago

Information in your post is not enough to make a comment or reproduce it.

snti commented 3 years ago

Hello @tanersener maybe my issue is related to AxitaKathiriya problem.

I just starting using this library, first of all, I tried to get info about a video using FFprobe.getMediaInformation method, but it returns null.

I tried with Uri and file.path

videoUri = content://[my app package].fileprovider/files/VID_2020_12_03_00_10_41_083.mp4
videoFile.getAbsolutePath() = /files/VID_2020_12_03_00_10_41_083.mp4

MediaInformation info = FFprobe.getMediaInformation(videoUri);
the result is null, the log say "Protocol not found"

MediaInformation info2 = FFprobe.getMediaInformation(videoFile.getAbsolutePath());
the result is null, the log say "No such file or directory"

AS 4.1.1 compileSdkVersion 29 Pixel 3aXL with android 11. The video was taken with Camera2 Api

Thanks!

tanersener commented 3 years ago

@snti Logs show what the problem is: Protocol not found. content: is not a valid protocol. See https://ffmpeg.org/ffmpeg-protocols.html

AxitaKathiriya commented 3 years ago

Hello @tanersener i am using below command. Command :- -i videopath -hide_banner

Here, I am using video path from my app's internal storage which is like (file:///data/user/0/temp/Record_2020-12-18-14-49-16.mp4) and also video path is in mp4 format.

When i getting info using this command then command is fail with return code 1.

Can you please tell me what is the meaning of return_code 1 ??

iamkathy27 commented 3 years ago

Hi @tanersener. First off, thank you so much for this library. It helped me a lot. However, I also encountered this issue, same with @AxitaKathiriya and I wonder if there's an update or is there a way to parse the media information from Config.enableLogCallback in Json format? Thank you very much!

tanersener commented 3 years ago

If you have the full output you can use MediaInformationParser.from() method for parsing.

tanersener commented 3 years ago

This project will be retired. Please consider switching to FFmpegKit.