i wish to find a solution to this issue i have been facing for a long while, trying to publish a reel on instagram. It keeps returning this error: Media upload has failed with error code 2207026 which means its not in the required format, i have tried with countless videos, uploaded them to my google drive and input the link to the video but still the same error, i came across this: Facebook Graph API - Getting error 2207026 when trying to upload video

And also implemented the last suggesstion in my code as shown below:

public String uploadFile(MultipartFile file) {         String extension = StringUtils.getFilenameExtension(file.getOriginalFilename());         var key = UUID.randomUUID() + "." + extension;         String directory = this.fileStorageLocation;         Path newPath = Paths.get(directory).toAbsolutePath().normalize();         try {             Files.createDirectories(newPath);             Path inputFilePath = newPath.resolve(StringUtils.cleanPath(key));             Path outputFilePath = newPath.resolve("output.mp4");             Files.copy(file.getInputStream(), inputFilePath, StandardCopyOption.REPLACE_EXISTING);             executeFFmpegCommand(inputFilePath.toString(), outputFilePath.toString());         } catch (IOException ex) {             Logger.getLogger(FileService.class.getName()).log(Level.SEVERE, null, ex);         }         return key;     }     private void executeFFmpegCommand(String inputFilePath, String outputFilePath) throws IOException {         String ffmpegPath = "C:\\ffmpeg\\bin\\ffmpeg.exe";         String[] ffmpegCommand = {                 ffmpegPath,                 "-i", inputFilePath,                 "-c:v", "libx264",                 "-aspect", "16:9",                 "-crf", "18",                 "-vf", "scale=iw*min(1280/iw\\,720/ih):ih*min(1280/iw\\,720/ih),pad=1280:720:(1280-iw)/2:(720-ih)/2",                 "-fpsmax", "60",                 "-preset", "ultrafast",                 "-c:a", "aac",                 "-b:a", "128k",                 "-ac", "1",                 "-pix_fmt", "yuv420p",                 "-movflags", "+faststart",                 "-t", "59",                 "-y", outputFilePath         };         ProcessBuilder processBuilder = new ProcessBuilder(ffmpegCommand);         processBuilder.inheritIO();         Process process = processBuilder.start();         try {             process.waitFor();             System.out.println("FFmpeg command executed successfully.");         } catch (InterruptedException e) {             throw new IOException("Error executing FFmpeg command: " + e.getMessage(), e);         }     } 

And uploaded the video to my drive and put in the link again, but still the same error, i dont know could be the issue, could someone provide a suggestion or a link to a video that has been tested with, because i dont see what am doing wrong, thanks.

Tag:java, facebook-graph-api, instagram-api, instagram-graph-api, instagram-reels

Add a new comment.