1

I'm trying to practice video editing with ffmpeg, I made a sample app which allows the users to either record a video then edit it or choose a video from gallery to edit.

When the user records videos with the application a temporary file is created then that file path is sent to ffmpeg to edit then save

"-i $videoPath  -vf crop=ih/$screenR:ih $outPath"

I'm just cropping the video then saving it as a test, The above command works as intended without any problems.

When I try to edit videos from gallery it doesn't work, I understand that the storage system in new versions of android devices is different, the uri is just an address to the content not an actual path to the file

the video path from gallery is something like this

content://media/external/file/38625

ffmpeg can not access the video with that path so it can't edit it, what should I do? thank you in advance.

MoTahir
  • 863
  • 7
  • 22
  • [Get Real Path of Gallery Video](https://stackoverflow.com/a/63085035/8325853) will help you. – Tushar Lathiya Jul 25 '20 at 07:33
  • I'm getting the path the same way you suggested but it isn't working, this is the path that I get content://media/external/file/38625, the VideoView has no problem with it but ffmpeg can't read the data from that path – MoTahir Jul 25 '20 at 08:08
  • How you got path? Please share code. – Tushar Lathiya Jul 25 '20 at 09:55
  • Sorry for the late reply, I'm following the first answer, that's how I get the item path https://stackoverflow.com/questions/57685725/mediastore-mediacolumns-data-is-deprecated-and-i-wanna-load-images-from-gallery – MoTahir Jul 26 '20 at 06:08
  • Did you manage to find a solution? – Leonardo Dias Oct 29 '20 at 01:01
  • No :( still searching, I was thinking about actually copying the content of the item stored in the gallery to a temporary file then delete the file once I'm done sending/editing my video but I am not sure if that is a good thing to do – MoTahir Nov 04 '20 at 12:35

0 Answers0