Home > Mobile >  Failed to convert any image file to a jpeg one using FFMPEG
Failed to convert any image file to a jpeg one using FFMPEG

Time:02-03

I'm trying to convert any image that is selected to a jpeg file, but my command keeps saying at least one output must be specified, this is the ffmpeg command

const selectImage = async () => {
const result = await launchImageLibrary({
      mediaType: 'photo',
      selectionLimit: 1,
    });
const tempPath = RNFS.TemporaryDirectoryPath   'uri.jpeg';
if (result.didCancel || result.assets.length === 0) return;
try {
    FFmpegKit.executeAsync(
        '-i '   result.assets[0].uri   ' -c:v '   tempPath
      )

I've look into many of the documentation with react native but i can't find a specific one in regards of converting only images, nor the packages specify it since the multimedia options given as packages are audio or video.

CodePudding user response:

the issue you're having is that -c:v doesn't have a parameter attached to it and instead thinks your output file is the encoder you're trying to use.

Either remove the -c:v option entirely, or run ffmpeg -encoders and choose one from the list (eg: -c:v libx264)

  • Related