Search code examples
linuxbashubuntuffmpeg

Check if a video file has subtitles


Is it possible to check if a video file has a subtitle using bash and get a simple answer like "yes" or "no". I don't need to know any details about the subtitles.

Maybe using ffmpeg?


Solution

  • This should display a 0 if subtitles are found, and any other value if not found.

    ffmpeg -i video -c copy -map 0:s:0 -frames:s 1 -f null - -v 0 -hide_banner; echo $?