5 ms·
Msync: Maintain lower-bitrate copy of your music files
- KMnO4 6y ago> I use msync to keep a secondary, 160 Kbps AAC copy of my music library. This is synchronized occasionally to my iPhone, which lacks the space for a music library consisting of lossless and higher-bitrate files. Correct me if I’m wrong, but isn’t this feature built in (since the early days of iPhone)? https://discussions.apple.com/thread/4792699 https://discussions.apple.com/thread/4792699
- minimaul 6y agoThis is built in to iTunes (or the Music app on newer macOS), but it comes with caveats - it doesn't really cache the converted files, so if it has to resync them it generates them each time.
- johnisgood 6y agoThis supports macOS only. > Requirements: at the moment, msync supports only macOS. This is because it uses macOS's built-in afinfo tool to determine music files' bitrates. You can simply use file[1] to get the bitrate on Linux if you have the metadata (if you lack the metadata, read below). I bet even macOS supports it, it is available on Unix, Unix-like, Plan 9, and IBM i. That, or you can use the MediaInfo[2] program or library, although I am not sure if it works with metadata or not. Using file: file foo.mp3 | sed 's/.*, \(.*\)kbps.*/\1/'| tr -d " " The result is in kbps. [1] https://en.wikipedia.org/wiki/File_(command) https://en.wikipedia.org/wiki/File_(command) [2] https://mediaarea.net/en/MediaInfo https://mediaarea.net/en/MediaInfo, https://mediaarea.net/en/MediaInfo/Download https://mediaarea.net/en/MediaInfo/Download You can download the CLI, GUI, or the library of MediaInfo. You want the CLI or the library. --- The above solutions may work only if you have the metadata (ID3, for example) set, although I am not sure about MediaInfo. Another solution would be using ffprobe[3] (requires ffmpeg), which for example returns this for a FLAC file: Metadata: Comment : Processed by SoX Duration: 00:00:26.20, start: 0.000000, bitrate: 527 kb/s Stream #0:0: Audio: flac, 48000 Hz, stereo, s16 It should not be based on any metadata. [3] https://ffmpeg.org/ffprobe.html https://ffmpeg.org/ffprobe.html
- krackers 6y agoDidn't work for me. I just get "Audio file with ID3 version 2.4.0, contains: ". I think that `file` will only pick it up if the bitrate is actually present in the ID3 info?
- johnisgood 6y agoWhat about ffprobe (requires ffmpeg)? For a FLAC file, I get: Metadata: Comment : Processed by SoX Duration: 00:00:26.20, start: 0.000000, bitrate: 527 kb/s Stream #0:0: Audio: flac, 48000 Hz, stereo, s16 You could extract 527 kb/s easily from this, too, and it should not be based on metadata. I edited my previous comment.
- minimaul 6y agoffprobe even handily has a -print_format json option, for machine readable output :)
- johnisgood 6y agoOh right! Completely forgot about that. ffprobe -print_format json -show_format -show_streams foo.flac This should be easy to parse.
- theamk 6y agoNice to read that there are some people keeping music on their computers! From talking to my friends, it sounds like everyone is just streaming all the time.
- johnisgood 6y agoOh, I do. I keep loads of FLACs on my computer. I even keep songs downloaded from YouTube before they got taken down. :) Is this really that uncommon with the enormous amount of storage capacity you can get for cheap these days? I even store TV series and movies. My line of thinking for this is: "what if they get 0 seeders and I will not be able to download them anymore?!". If I had an account to one of those streaming services, it would be: "what if my account got disabled/suspended for some reason?", or "what if their servers die?", and so forth.
- minimaul 6y agoDepending on what you like to listen to, streaming services don't always have it available. I like game soundtracks a lot while developing, and there's a very limited selection on services like Spotify. It's getting more varied, but it's still not great.
- krackers 6y agoI think the dependency on ffmpeg should be stated in the README (unless it's there and I missed it?)
- minimaul 6y agoThis is quite nice. I maintain an app personally to do similar things - I also generate .m3u8 playlists. Unfortunately it uses ffmpeg's AAC encoder, which isn't the best. I went for using XLD's command line tools on mac to encode to AAC using Apple's codec, and that does produce better results - I tried afconvert to start with and had a lot of issues.
- jorams 6y agoRather than keeping a lower-quality copy of my music on my phone, I stream my own music library by running MPD[1] in a satellite setup. All files are served by a simple webserver[2] that converts them to Opus when requested, to save bandwidth. Music I never listen to never gets converted. I wrote about my setup here[3]. This won't work on iPhone, since MPD hasn't been ported, but it works great for Android. [1]: https://www.musicpd.org/ https://www.musicpd.org/ [2]: https://git.sr.ht/~joram/transcoding-music-server https://git.sr.ht/~joram/transcoding-music-server [3]: https://www.joram.io/blog/android-streaming-mpd/ https://www.joram.io/blog/android-streaming-mpd/
- rakoo 6y agoIt's a shame you have to jump through so many hoops just to have your own music wherever you want it. I did something similar a long time ago, a process that transcodes music on-the-fly with ffmpeg and exposes the ogg version through a FUSE filesystem, also built with go (https://github.com/rakoo/codecfs/ https://github.com/rakoo/codecfs/). I just tested and you can export this FUSE filesystem through SFTP, and VLC on Android can open remote folders through SFTP... so you can have your entire library compressed on-the-fly on both Android and iOS, and there is no lag between input and playback. If you want to keep a song on your phone for offline use, like the OP link usecase, just copy the file locally: it works today, without installing anything or running stuff on your computer. Filesystems all the way down and it works transparently (even though to be even cleaner SFTP should be mountable and available as a standard folder in Android). Somewhere in there Plan9 says "I told you so". (Note if you're doing that: there is an issue with entering credentials on Android with SFTP, see https://code.videolan.org/videolan/vlc-android/-/issues/1508 https://code.videolan.org/videolan/vlc-android/-/issues/1508)
- Terretta 6y agoYou don’t really have to jump through hoops if you value cash less than hoop jumping time. iTunes Match is still around: “iTunes Match gives you access to all of your music on all of your devices, even songs that you've imported from other sources such as CDs.” https://support.apple.com/en-us/HT204146 https://support.apple.com/en-us/HT204146 It’s $25 a year, and will cheerfully upgrade crappy .mp3s of dubious origin from the 90s-00s to high bitrate drm-free AAC. “Matched, uploaded, and purchased tracks reside in iCloud Music Library, Apple's cloud-based music locker. Users can stream or download these tracks from iCloud Music Library to any of their 10 devices as long as their iTunes Match subscription remains active; downloaded tracks will either show up as a 256kbps matched DRM-free AAC file or an AAC-converted file of tracks you uploaded on devices other than the Mac or PC from which tracks were uploaded. If you uploaded music in WAV, ALAC, or AIFF formats, then they will remain in those formats on the Mac or PC from which they were uploaded.” https://www.imore.com/apple-music-vs-itunes-match-whats-difference https://www.imore.com/apple-music-vs-itunes-match-whats-diff... I moved from home grown to this when it first came out, as for me the $25 a year was worth not maintaining anything.