4

I am running following command to extract audio from videos and merge them into a single file:

-y -hide_banner -i /storage/emulated/0/Videos/video_4.mp4 -i /storage/emulated/0/WhatsApp/Media/WhatsApp Video/VID-20210430-WA0010.mp4 -i /storage/emulated/0/WhatsApp/Media/WhatsApp Video/VID-20210430-WA0052.mp4 -filter_complex [0:a]atrim=duration=1119.028,volume=1[a_0];[1:a]atrim=duration=84.057,volume=1[a_1];[2:a]atrim=duration=278.029,volume=1[a_2];[a_0][a_1][a_2]concat=n=3:v=0:a=1[audio] -map [audio] -acodec aac -vn /storage/emulated/0/Videos/audio.aac 

But ffmpeg says

/storage/emulated/0/Videos/video_4.mp4: No such file or directory

I can ensure that the file exist on that specified path. What might cause the issue?

Note: The same error occures for some other comands too, but in all the cases the video file exist in the specified path.

Yeamin Chowdhury
  • 502
  • 1
  • 9
  • 19
  • 1
    You might not have read access to the `video_4.mp4` file. Beyond that, if that is the literal command in the first code snippet, you are not quoting the filesystem paths, so the whitespace in `WhatsApp Video` may confuse the command executor, when you get past your first problem. – CommonsWare May 21 '21 at 17:47
  • I do have read access on that file. This error occurs even for some of the file without whitespace in the path. – Yeamin Chowdhury May 21 '21 at 17:50
  • 1
    How did you obtain read access? Android version of used device? – blackapps May 21 '21 at 18:08
  • I used runtime permission to obtain read access. Not bounded to any specific android version, but most of them are from API version 28. I can ensure that the file exist and is not read only because just before running this particular command another command executed successfully on the same file. – Yeamin Chowdhury May 21 '21 at 18:32
  • Why cannot be the file read only? It is only read i think. Or are you gonna modify it? Isnt ffmpeg a different app that you try to start? If so then it does not have the same permissions. – blackapps May 21 '21 at 18:44
  • Try adding this flag: `-allowed_extensions ALL`. – Darkman May 21 '21 at 18:48
  • @Darkman the exact same command works for most of the cases without the `-allowed_extensions ALL` flag. Can you please explain the reason to use this flag? Note: I couldn't reproduce the issue in any of my devices, so I cant't verify if your solution works or not for now. – Yeamin Chowdhury May 23 '21 at 04:59
  • 1
    @MdYeamin Well I'm not really sure if that is going to help you. Sometimes, when I am using ffmpeg for m3u8 files, ffmpeg refuses to do anything because of security issues - and adding that flag helps. I suggest you to add `-loglevel 40` to ffmpeg for more verbose output and always redirect the output into a file. – Darkman May 23 '21 at 06:18
  • @MdYeamin have you got solution? – Addy Oct 29 '21 at 09:29

1 Answers1

2

I had the same problem, I installed it using snap.

So, as a solution, I tried uninstalling using remove and purge, and then I used mv /snap/bin/ffmpeg /snap/bin/ffmpeg_old.

Then I installed using apt-get install ffmpeg, and worked. I guess the problem was the version of ffmpeg.

dadadima
  • 938
  • 4
  • 28