0

I have never done any programming until now, so I am open to any language. How do I start on a script to sort videos into those with sound and those without sound? I have hundreds of short mp4/avi clips that are randomly named. Is it possible to write a piece of code that automatically sorts them based on whether they have audio?

Can anyone write me the script? I would be eternally grateful. If not, can anyone point me to some easy to understand tutorials? I was told to use ffprobe and a script but I have no idea how to start.

Thanks

Binarus
  • 4,005
  • 3
  • 25
  • 41
  • Possible duplicate of [Using ffprobe to check audio-only files](https://stackoverflow.com/questions/32278277/using-ffprobe-to-check-audio-only-files) – Aran-Fey Oct 01 '17 at 10:39
  • Off topic on the site due to "Can anyone write me the script?" - it is not what this site is about. If you can at least make a first attempt and explain where stuck, the question might be rescued. You may want to try some very basic language tutorials, such as https://www.codecademy.com/tracks/python – Neil Slater Oct 01 '17 at 10:42

1 Answers1

0

On Windows, you can run directly at the command line,

for %i in (*.mp4 *.avi) do ffmpeg -i "%i" -v 0 -map a -t 0.1 -f null - && move "%i" with-audio || move "%i" no-audio

where with-audio and no-audio are sub-folders you created in the location where you ran the command. You can, of course, replace these with absolute paths to a central set of folders. If using within a batch file, replace %i with %%i

Basic logic is that the given ffmpeg command will report success if a given file has audio and failure otherwise. In the former case, the command after the && gets executed, In the latter, the command after the || gets executed.

Gyan
  • 85,394
  • 9
  • 169
  • 201