Coder Social home page Coder Social logo

Comments (8)

tanersener avatar tanersener commented on July 20, 2024 1

I fixed it on the development branch.

from ffmpeg-kit.

tanersener avatar tanersener commented on July 20, 2024

I tested your code using test applications under the ffmpeg-kit-test repository but didn't get any errors. I suggest doing the same and testing your issue with them. There is an SAF tab inside those apps. You can modify and use it to reproduce this issue.

from ffmpeg-kit.

blue-peacock avatar blue-peacock commented on July 20, 2024

Have you tried with an image?
When I try to create a video it works without an error using the following code:

                String filePrefix = "video";
                String fileExtn = ".mp4";
                ContentValues contentValues = new ContentValues();
                contentValues.put(MediaStore.Images.Media.RELATIVE_PATH, "Movies/Test");
                contentValues.put(MediaStore.Images.Media.DISPLAY_NAME, filePrefix + fileExtn);
                contentValues.put(MediaStore.Images.Media.MIME_TYPE, "video/mp4");
                outUri = requireContext().getContentResolver().insert(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, contentValues);

With the following code to create an image I'm able to reproduce the Could not open file error in your SAF Test application:

                String filePrefix = "image";
                String fileExtn = ".jpeg";
                ContentValues contentValues = new ContentValues();
                contentValues.put(MediaStore.Images.Media.RELATIVE_PATH, "Pictures/Test");
                contentValues.put(MediaStore.Images.Media.DISPLAY_NAME, filePrefix + fileExtn);
                contentValues.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
                outUri = requireContext().getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues);

I was using the following ffmpeg command for testing the video and image code. In the video case it works.

            final String ffmpegCommand = "-i " + image1File.getAbsolutePath() + " -i " + image2File.getAbsolutePath() + " -filter_complex \"[0]transpose=1[a]; [1]scale=100:100[2]; [a][2]overlay=300:300[b]; " +
                    "[b]drawtext=fontfile=/system/fonts/DroidSans.ttf: text='Text': fontcolor=black: fontsize=100: x=100: y=90: box=1: [email protected]: boxborderw=20:\" -qscale:v 0 " + videoPath;

from ffmpeg-kit.

tanersener avatar tanersener commented on July 20, 2024

It seems like this case is not handled by the SAF support implemented in ffmpeg-kit. As far as I understand, your command uses image2 muxer to encode the output jpeg file. But, image2 muxer doesn't know how to open those SAF urls. That's why your command fails.

SAF wrapper approach taken by ffmpeg-kit covers most of the cases. But it doesn't cover this one. And, it is not easy to use the same approach to handle your case. Because image2 muxer is an ffmpeg module. And, modifying its behaviour means modifying ffmpeg source code. Which is something we avoid.

We need to revisit the design of SAF support in ffmpeg-kit to handle this case.

from ffmpeg-kit.

blue-peacock avatar blue-peacock commented on July 20, 2024

Ok thanks. Interesting that the same command works in the video case but not in the image case. So there is no other (SAF compatible) way to overlay 2 images than this command?

from ffmpeg-kit.

tanersener avatar tanersener commented on July 20, 2024

Most probably no. But I'm not % 100 sure.

from ffmpeg-kit.

abkoradiya avatar abkoradiya commented on July 20, 2024

@tanersener Is this issue fixed?

from ffmpeg-kit.

tanersener avatar tanersener commented on July 20, 2024

Fixed in v4.5 release.

from ffmpeg-kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.