3

I need to analyze the video and audio in an MKV or MP4 container for timestamps where the screen is blank and/or there's no audio.

I'd like to use this to generate chapter files for some video files.

How can I do this, preferably on Linux?

slhck
  • 235,242
robmathers
  • 537
  • 1
  • 5
  • 12

1 Answers1

5

The tool ffmpeg can do both types of analysis using built in plugins (silencedetect and blackdetect) an runs on Linux (and a lot of other OSs), here are some example calls for acomplish what you want, in both examples is looking for 100ms blacks or 100ms silences, you can combine the two outputs to have all the times where a silence or black screen appears:

ffmpeg -i input.mp4 -af silencedetect=n=-50dB:d=0.1 -f null -

ffmpeg -i input.mp4 -vf blackdetect=d=0.1:pix_th=.1 -f rawvideo -y /dev/null

Giacomo1968
  • 58,727
nahog
  • 66