bluepuper
bluepuper

Reputation: 404

ffmpeg says that file doesn't exist, but it actually exists

Trying to extract audio from video so in my NestJS controller i used ffmpeg to solve it, but it says me that file does not exist This is my handler in controller:

try {
    let process = new ffmpeg("/uploads/0.777341078548575.mp4")
    process.then(function (video) {
        video.fnExtractSoundToMP3(
            '/uploads/audio/test/007',
            function (error, file) {if (!error) console.log('Audio file: ' + file)}
        )
    }, function (err) {
           console.log('Error: ' + err)
    })
} catch (e) {
    console.log("CATCHED ERROR", e)
}

And this is what ffmpeg says me CATCHED ERROR { code: 103, msg: 'The input file does not exist' } But i used right path, so cant get where the problem is, on the picture you can see where my video file is store enter image description here

I tried different paths: ../../uploads/0.777341078548575.MP4, /uploads/0.777341078548575.MP4, ../../uploads/0.777341078548575.mp4, /uploads/0.777341078548575.mp4 and also all these paths without .mp4 or .MP4

Upvotes: 0

Views: 1512

Answers (2)

Shivam
Shivam

Reputation: 3642

Your .ts file is in transcribation/transcribation.controller.ts but the file you are accessing is not in the same folder. It's actually 1 level up.

Make sure you are going 1 level up to access the videos

let process = new ffmpeg("../uploads/0.1831579264771055.mp4")

Upvotes: 3

Siti Nurlaelah
Siti Nurlaelah

Reputation: 1

The answer is Reinstall ffmpeg Or using Sudo command

Upvotes: 0

Related Questions