Home of the Squeezebox™ & Transporter® network music players.
Page 3 of 11 FirstFirst 12345 ... LastLast
Results 21 to 30 of 102
  1. #21
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    1,012
    Quote Originally Posted by chill View Post
    Thanks - that's a lot easier than scrolling through a long list of codecs. All I get from that command is:
    Code:
    DEA.L. aac                  AAC (Advanced Audio Coding) (decoders: aac aac_fixed )
    DEA.L. vorbis               Vorbis
    See here for a ffmpeg audio guide, including quality produced:
    libopus > libvorbis >= libfdk_aac > aac > libmp3lame >= eac3/ac3 > libtwolame > vorbis > mp2 > wmav2/wmav1
    so you might want to use aac, as libvorbis seems to be missing from your ffmpeg version.

    ffmpeg will also copy tags, and can do loudness normalization, which might be a good idea for your use case (unless you use replay gain and are sure all tools in the transcoding process will honor it)
    Various SW: Web Interface | Playlist Editor / Generator | Music Classification | Similar Music | Announce | EventTrigger | LMSlib2go | ...
    Various HowTos: build a self-contained LMS | Bluetooth/ALSA | Control LMS with any device | ...

  2. #22
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Location
    Nottingham, UK
    Posts
    1,652
    Quote Originally Posted by Roland0 View Post
    See here for a ffmpeg audio guide, including quality produced:

    so you might want to use aac, as libvorbis seems to be missing from your ffmpeg version.

    ffmpeg will also copy tags, and can do loudness normalization, which might be a good idea for your use case (unless you use replay gain and are sure all tools in the transcoding process will honor it)
    Thanks Roland - that's a useful ink. I'd used the experimental vorbis encoder, which seems to be strongly discouraged. Can these extra libraries and encoders be added to the compiled version by the end user, or is it only a build option?

    oggenc seems to do what I want - a 1-step converter from FLAC to OGG, which maintains any tags. I do have some single-track FLAC files in my collection, so tag preservation is useful, although most of my collection uses whole-album FLAC images with CUE files, and for these files all the tags, including replay gain tags, are in the CUE files, so tag preservation isn't required.

    I don't yet have many cue files with replay gain tags, but the author of XLD (the ripper I use on my Macbook) has recently provided me with an updated command line version, in response to a feature request*, that will add replay gain tags to cue files. So at some point I'll run that on all my whole library, and then re-create the OGG-specific cue files.

    *Not only is XLD a fantastic, free, ripper for the MAC, but I was astonished when the author added this new functionality for me within a couple of days. The updated source code is available in Sourceforge, but the compiled version hasn't been updated yet.

  3. #23
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    1,012
    Quote Originally Posted by chill View Post
    Can these extra libraries and encoders be added to the compiled version by the end user, or is it only a build option?
    build option
    You could build a static version of ffmpeg with all audio codecs included on another ARM machine (or cross compile it), and copy it to your Pi.
    Various SW: Web Interface | Playlist Editor / Generator | Music Classification | Similar Music | Announce | EventTrigger | LMSlib2go | ...
    Various HowTos: build a self-contained LMS | Bluetooth/ALSA | Control LMS with any device | ...

  4. #24
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Location
    Nottingham, UK
    Posts
    1,652
    Quote Originally Posted by Roland0 View Post
    build option
    You could build a static version of ffmpeg with all audio codecs included on another ARM machine (or cross compile it), and copy it to your Pi.
    I was afraid that would be the case!

    Oggenc, from the latest vorbis-tools (1.4.0), is doing the job perfectly for me, so I don't think I'll be attempting to build my own ffmpeg. My transcoding script is currently working its way through the flac files in my library and making oggs in a mirrored folder. After almost a day, I'm up to 'G' in the alphabet. I'm using a spare Pi 3B+ which isn't doing anything else at the moment, so I'm happy to leave it working. Each album flac takes about the same time to transcode on the Pi as it did to rip in the first place. Once it's done I'll make another script to do the cue files, and then the folder artwork, and finally all the lossy files that just need to be copied over rather than transcoded.

    My transcoding script works on a single file, but is invoked with the 'find -iname *.flac' command, so will work through the list of all flac files that that command finds. It skips the transcoding if the ogg file already exists, so in fact I'll be able to run it as another cron process on a regular basis, just like the rsync backup. That'll mean I always have an up-to-date full backup and an up-to-date compressed mirror, and I'll be able to update my portable flash drive copy from the compressed mirror at any time with a single rsync command.

    Here's my current script. I'm not particularly practiced at scripting, so others may see better ways of doing the same, but it might be useful to someone.
    Code:
    # script to convert input FLAC file to OGG
    # $1 = filename of FLAC file - doesn't matter whether absolute or relative path
    # $2 = Part of absolute path to remove 
    # $3 = New absolute path to prepend
    # e.g. ./flac2ogg.sh /mnt/MusicBackup/Music/flacs/somefile.flac /mnt/MusicBackup/Music /mnt/MusicBackup/MusicOgg
    # will produce    /mnt/MusicBackup/MusicOgg/flacs/somefile.ogg
    
    # use with 'find' command as follows: (-iname = case insensitive)
    # sudo find -iname *.flac -exec /home/tc/flac2ogg.sh {} /mnt/MusicBackup/Music /mnt/MusicBackup/MusicOgg ";"
    
    # find full path of input file
    infile=$(realpath "$1")
    
    # path to remove from start of input
    pathremove="$2"
    
    # path to prepend
    pathprepend="$3"
    
    # remove input path
    outfile=${infile#$pathremove}
    
    # prepend new path
    outfile="$pathprepend$outfile"
    
    # get extension
    ext="${infile##*.}"
    
    # replace extension with 'ogg' (allows for any Case, such as flac, FLAC, Flac etc)
    # not really needed with oggenc (which replaces the extension automatically), 
    # but this allows writing to tmp file and then renaming to ogg file
    tmpfile=${outfile%$ext}tmp
    outfile=${outfile%$ext}ogg
    
    #extract full path of output file
    outpath=$(dirname "$outfile")
    
    #make directory for output path. -p = ignore 'exists' errors and create parent directories
    mkdir -p "$outpath"
    
    # convert input flac to output ogg
    # only do conversion if output ogg doesn't already exist
    if [ ! -f "$outfile" ];
    	#then echo $outfile
    	#then flac --decode --stdout "$1" | lame  -h --preset standard - "$outfile"
    	#then ffmpeg -i "$infile" -b:a 128k "$outfile"
    # encode to tmp file, then rename to OGG: means the script can be stopped at any time and restarted
    # without having to clear up a partially finished OGG file (because any partially finished tmp file will be overwritten)
    	then oggenc -q 5 "$infile" -o "$tmpfile"
    	mv "$tmpfile" "$outfile" 
    fi
    Last edited by chill; 2019-04-27 at 23:25.

  5. #25
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Location
    Nottingham, UK
    Posts
    1,652
    Up to 'J' now

    The Pi CPU is sitting at a comfortable 59 degrees, but the oggenc process is only occupying 25% of the CPU. Since it's a 4-core processor, presumably that means that oggenc is only using one core. Out of interest, is there a way to make it use more, or would oggenc have to be compiled specifically for multi-core processors?

  6. #26
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    2,632
    An idea to cater for when you might do a re-rip that overwrites a flac in the source

    #This works in the default shell in pCP so I expect will work in more complete shells elsewhere
    Code:
    source_file=a.flac;
    target_file=a.ogg;
    
    if [ "$source_file" -nt "$target_file" ]
    then
        printf '%s\n' "$source_file is newer than $target_file"
    fi
    i.e. in the part where you check for the ogg file already existing you could add a check to see if the .flac is newer than the .ogg and then do the encoding bit if it is.
    Paul Webster
    http://dabdig.blogspot.com
    Author of "Now Playing" plugins covering Radio France (FIP etc), KCRW, Supla Finland, ABC Australia, CBC/Radio-Canada and RTE Ireland

  7. #27
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Location
    Nottingham, UK
    Posts
    1,652
    Great idea, thanks Paul. I didn't know how to implement such a check. I'll do the same for the cue file generation and album art files, since I often find myself updating those.

  8. #28
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    1,012
    Quote Originally Posted by chill View Post
    Since it's a 4-core processor, presumably that means that oggenc is only using one core. Out of interest, is there a way to make it use more, or would oggenc have to be compiled specifically for multi-core processors?
    afaik, oggenc is single-threaded - that's why scripts like flac2all transcode n files in parallel.
    You can achieve something similar with
    Code:
    find -print0 ... |  xargs -0 -P 4 ...
    Regarding the check if the .flac is newer than the .ogg: If you replace the original with a new version having a modification date older than the date of the conversion, the check will miss it.
    For my use case, this is a possibility, so my script sets the modification date of the converted file to the modification date of the original file.
    Various SW: Web Interface | Playlist Editor / Generator | Music Classification | Similar Music | Announce | EventTrigger | LMSlib2go | ...
    Various HowTos: build a self-contained LMS | Bluetooth/ALSA | Control LMS with any device | ...

  9. #29
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Location
    Nottingham, UK
    Posts
    1,652
    Thanks Roland

    xargs is new to me, but looks very useful, and the -P option seems like it will allow me to run multiple oggenc jobs in parallel on different cores - is that right? I'll keep that in mind if I have to do this conversion again - for now I've had to put this aside till the end of the week, so I've left the Pi running and it should have finished by the time I get back to it.

    I'm struggling to see a situation where a new version of the flac file would have a modification date earlier than a previous ogg version. You say that's a possibility in your case - can you explain how?

  10. #30
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    1,012
    Quote Originally Posted by chill View Post
    xargs is new to me, but looks very useful, and the -P option seems like it will allow me to run multiple oggenc jobs in parallel on different cores - is that right?
    Yes, -P 4 will speed up the process by ~4 times on a Pi.

    I'm struggling to see a situation where a new version of the flac file would have a modification date earlier than a previous ogg version. You say that's a possibility in your case - can you explain how?
    That's certainly a corner case, and if you just rip your CDs or buy some digital download, it won't affect you.
    For me, there are two scenarios where this can happen:
    - Replacing a downloaded album with a higher quality version of itself (Example: this vs. this)
    - Replacing a downloaded live album with a different recording of the concert (Example: this vs. this)

    While the probability of this happening may be low, it's just one line of Python code to copy the attributes from the original to the transcoded file.
    Various SW: Web Interface | Playlist Editor / Generator | Music Classification | Similar Music | Announce | EventTrigger | LMSlib2go | ...
    Various HowTos: build a self-contained LMS | Bluetooth/ALSA | Control LMS with any device | ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •