Skip to content

Instantly share code, notes, and snippets.

@visualblind
Created June 3, 2020 00:46
Show Gist options
  • Save visualblind/0cd3b280e0e0ed59130f23f1528a2ddd to your computer and use it in GitHub Desktop.
Save visualblind/0cd3b280e0e0ed59130f23f1528a2ddd to your computer and use it in GitHub Desktop.
Output the audio codec of media files with FFmpeg
#!/usr/bin/env bash
find . -depth -maxdepth 2 -regextype posix-extended -regex '.*\.mkv$|.*\.mp4$' -type f -exec bash -c 'echo "{}" $(ffprobe -loglevel error -select_streams a:0 -show_entries stream=codec_name -of default=nw=1:nk=1 "{}")' \;
# stdout media files not using the AAC codec:
find . -mount -depth -maxdepth 2 -regextype posix-extended -regex '.*mkv$|.*mp4$' -type f -exec bash -c \
'echo "{}" $(ffprobe -loglevel error -select_streams a:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "{}")' 2>/dev/null \; \
| grep -v 'aac$'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment