Hello Romain,

Thanks so much for your comprehensive reply.

Please see below ...

On Mon, Jun 10, 2013 at 3:36 PM, Romain Beauxis <[email protected]>wrote:

> 2013/6/10 Bill Burton <[email protected]>:
> > Hello,
>
> Hi,
>
> > I have a workflow where I take an MP3 voice recording and transcode it to
> > two files, one a 32 Kbps MP3 suitable for posting on a web site and the
> > other, an Ogg Vorbis file I use for broadcasting.
> >
> > In the process of transcoding the original file, I want to 1) preserve
> ID3
> > tags, 2) Process for ReplayGain (by track) adding those tags.
> >
> > Based on an example in the LS Cookbook, I wrote the following:
> >
> > #!/usr/bin/liquidsoap
> > # Transcode an audio track into two other formats.
> >
> > set("log.stdout", true)
> > set("log.file", false)
> > set("log.level", 3)
> >
> > # input file
> > input = "test.mp3"
> > # output files
> > output_mp3 = "file.mp3"
> > output_ogg = "file-q1.ogg"
> >
> > # A source that plays the the file once
> > source = once(single(input))
> >
> > # Use a clock with disabled synchronization
> > clock.assign_new(sync=false, [source])
> >
> > output.file(%mp3.cbr(samplerate=22050, mono=true, bitrate=32),
> >             fallible=true, reopen_on_metadata=false, output_mp3,
> >             source)
> >
> > output.file(%vorbis(quality=1, samplerate=44100, channels=1),
> >             fallible=true, reopen_on_metadata=false, output_ogg,
> >             on_stop=shutdown, source)
> >
> >
> > It appears to copy the tags to the .ogg file successfully but not to the
> > .mp3 file.  Is there anything I can do to get the metadata copied from
> the
> > original mp3 file to the transcoded one?
>
> Yes, you need to add id3v2=true to the %mp3 encoder parameters:
>
>   output.file(%mp3.cbr(samplerate=22050, mono=true, bitrate=32,
> id3v2=true), ...
>

This works for me.


>
> > Also, is there a way to perform ReplayGain tagging on these files?
>
> Yes! Documentation is there:
>   http://liquidsoap.fm/doc-svn/replay_gain.html
>
> If you're lucky, all you have to do is add this at the beginning of your
> script:
>   enable_replaygain_metadata()
>

Not on Windows.  The supporting script is not available and Perl is
required to run it.


>
> And then wrap your source inside an amplify operator:
>   s = amplify(1.,override="replay_gain",s)
>

Okay.  I would be content just copying the replay gain tags from the source
file to the target files. Seem to recall there's a setting which lists the
tags to copy. It doesn't include the replay gain tags but I would think
that if I add them, then the tags would also be copied from the source to
the target files.


> > In addition, instead of hard coding the input file, I need to grab it
> from
> > the command line but so far, haven't been able to figure out how to use
> > system.argv.
>
> You have argv(default="foo", 1) which returns argument number 1 with
> default "foo" if not provided and you also have getopt which is a bit
> more complex: getopt("-o") returns “1” if “-o” was passed without any
> parameter, “0” otherwise. getopt(default="X","-o") returns “Y” if “-o
> Y” was passed, “X” otherwise. The result is removed from the list of
> arguments, affecting subsequent calls to argv() and getopt().
>

What I had been attempting to do is: log(argv(1)) or similar just to see if
it worked (which it didn't).  However when I changed the above script to:
    input = argv(1)

it worked fine.

The next challenge is I'm trying to translate the filename using
string.replace() but I've not been able to figure out how to call it.  All
my input files have a suffix of "-96Kbps.mp3" or "-128Kbps.mp3" which I'm
trying to simply strip that off and then tack on a different suffix
depending on the output file type:

    # how to make this work?
    input_base = string.replace(pattern="\-\d\d*[Kk]bps$", ???, input)

I know how to do this in Ruby or Perl but I'm having trouble grasping Ocaml.


> > Right now, I'm testing the script on Windows liquidsoap 1.1.1 but could
> move
> > it to Ubuntu 12.04.
>
> I'd recommend moving it to ubuntu for the replaygain part. Support for
> replay gain needs external binaries and this is not guaranteed to work
> smoothly under window..
>

Yes, upon looking into this by reviewing the source in libs, the
enable_replay_gain() call fails because the Perl
script extract-replaygain doesn't exist the Windows distribution.  This
script depending on the file extension or mime type, delegates to the
appropriate binary to apply ReplayGain tags then another call to read their
results to pass back to liquidsoap via stdout.  If the script did exist, it
*might* work on Windows if Perl was installed and on the PATH.

Thanks for your help!
-Bill
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to