edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiBf15570fTahinli3 months ago397 commits
| 1 | #!/usr/bin/env bash |
| 2 | # scan-real-library.sh — ffprobe sweep of the user's real media library. |
| 3 | # |
| 4 | # READ-ONLY on the scanned directories; the only thing written is the manifest |
| 5 | # under fixtures/ (gitignored — regenerable). The manifest is the T3 gate input: |
| 6 | # every codec/container claim in this repo is checked against these files, not |
| 7 | # only against synthetic fixtures. |
| 8 | # |
| 9 | # Usage: scripts/scan-real-library.sh [dir ...] (default: ~/Videos ~/Downloads) |
| 10 | # Env: EC_FIXTURES=<dir> (default <repo>/fixtures) |
| 11 | # Out: fixtures/real-library-manifest.tsv |
| 12 | # columns: path container vcodec width height pix_fmt bit_depth acodecs duration size |
| 13 | |
| 14 | |
| 15 | |
| 16 | ROOT= |
| 17 | FIXTURES= |
| 18 | OUT=/real-library-manifest.tsv |
| 19 | |
| 20 | || { ; ; } |
| 21 | |
| 22 | DIRS=("") |
| 23 | [ && DIRS=("/Videos" "/Downloads" "/Music") |
| 24 | |
| 25 | EXTS=(mp4 m4v mov mkv webm avi flv ts m2ts mts wmv ogv |
| 26 | mp3 m4a aac flac wav ogg oga opus wma ac3 eac3 alac aif aiff) |
| 27 | |
| 28 | |
| 29 | tmp= || |
| 30 | |
| 31 | |
| 32 | # Build the -iname predicate list once. |
| 33 | find_args=() |
| 34 | for; do find_args+=(-iname "*." -o); done |
| 35 | |
| 36 | |
| 37 | # field <key> <ffprobe-kv-block> — "" when absent or N/A. |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | n=0 |
| 46 | nerr=0 |
| 47 | { |
| 48 | |
| 49 | while ; do |
| 50 | # Key=value form (not nk=1): a field ffprobe omits must not shift the others. |
| 51 | fmt= |
| 52 | |
| 53 | if [; then |
| 54 | nerr= |
| 55 | |
| 56 | continue |
| 57 | fi |
| 58 | container= |
| 59 | duration= |
| 60 | v= |
| 61 | |
| 62 | |
| 63 | vcodec= |
| 64 | vw= |
| 65 | vh= |
| 66 | vpix= |
| 67 | vbits= |
| 68 | # bits_per_raw_sample is often absent/0 — fall back to the pix_fmt suffix. |
| 69 | if [ || [ || [; then |
| 70 | case in |
| 71 | *12le | *12be) vbits=12 ;; |
| 72 | *10le | *10be) vbits=10 ;; |
| 73 | "") vbits="" ;; |
| 74 | *) vbits=8 ;; |
| 75 | esac |
| 76 | fi |
| 77 | acodecs= |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | n= |
| 84 | done |
| 85 | } |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | | | | | |
| 94 | |
| 95 | | | | | |
| 96 | |
| 97 | | | | | | |
| 98 | |
| 99 | | | | | |