Skip to content

Instantly share code, notes, and snippets.

@hadret
Created October 12, 2023 10:18
Show Gist options
  • Save hadret/bd1070a492b7c8d805f0c428adc725b3 to your computer and use it in GitHub Desktop.
Save hadret/bd1070a492b7c8d805f0c428adc725b3 to your computer and use it in GitHub Desktop.
I ain't easily foldable, am I?
  • Resources
  • Transcode
    • cd /var/subsonic/transcode
      ln -sf /usr/bin/ffmpeg ffmpeg
      ln -sf /usr/bin/flac flac
      ln -sf /usr/bin/lame lame
  • MP3
    • ConvertFrom = mp3
      ConvertTo = mp3
      Step1 = ffmpeg -f mp3 -i %s -ab %bk -v 0 -f mp3 -
      
  • FLAC
    • ConvertFrom = flac
      ConvertTo = mp3
      Step1 = flac --silent --decode --stdout %s
      Step2 = lame --silent -h -b %b -
      
  • MPC -> MP3
    • #!/bin/bash
      for file in *.mpc ; do
      mpcdec "$file" - | lame -h - "${file%.mpc}.mp3";
      done
      
      mkdir mpc.old
      mv *.mpc mpc.old/
  • [[FreeBSD]]
    • Default:
      • [mp3 audio] [ogg oga aac m4a flac wav wma aif aiff ape mpc shn] [mp3] ...[ffmpeg -i %s -map 0:0 -b:a %bk -v 0 -f mp3 -]
        
    • Transcoding in Subsonic is a way to re-encode music on the fly to a format your listening device supports. A common use is transcoding FLAC, WMA, and Vorbis audio to MP3 for devices supporting only that codec.
    • Configuring transcoding uses up to three commands one would use on a normal command line pipe but with a whitelist of executables installed or linked into /var/subsonic/transcode. The transcoding configuration page takes transcoding rules in the form of:
      • [rule name] [convert from] [convert to] [command 1] [command 2] [command 3]
        
    • The most compatible single audio transcoding command is with FFmpeg, transcoding any input to MP3, mapping all streams to output, and limiting metadata to the more-compatible ID3v2.3:
      • [All to MP3] [ogg flac wma aiff m4a] [mp3] ...
        [ffmpeg -i %s -ab %bk -id3v2_version 3 -map_metadata 0 -map 0:0 -ar 44100 -ac 2 -v 0 -f mp3 -]
        
    • You can also transcode with multiple single-codec commands to avoid the heavy [[FFmpeg]] dependency:
      • [FLAC to MP3] [flac] [mp3] ...
        [flac --silent --decode --stdout %s] [lame --silent -h -b %b -]
        
        [AAC to MP3] [m4a] [mp3] ...
        [faad -s -o - %s] [lame --silent -h -b %b -]
        
      • [Vorbis to MP3] [ogg] [mp3] ...
        [oggdec -Q -o /dev/stdout %s] [lame --silent -h -b %b -]
        
      • [MPC to MP3] [mpc] [mp3] ...
        [mpcdec %s -] [lame --silent -h -b %b -]
        
        [APE to MP3] [ape] [mp3] ...
        [mac %s - -d] [lame --silent -h -b %b -]
        
      • [Trackers to MP3] [mod s3m xm it] [mp3] ...
        [xmp -q -c %s] [lame --silent -h -b %b -]
        
  • [[BastilleBSD]] jail setup
    • zfs create zroot/bastille
      bastille bootstrap 12.2-RELEASE
      bastille mount subsonic /usr/ports /usr/ports nullfs rw 0 0
      bastille mount subsonic /usr/music /mnt/music nullfs rw 0 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment