Quick and Dirty Transcoder

Amarok 1.x Scripts

Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net

0
5 .0
Description:

dirtyxcode provides a simple shell script that adds transcoding
support to Amarok. The only prerequisites are that you have
gstreamer installed and the appropriate plugins.

dirtyxcode works with transcoding when copying files to a media
player and also adds a context menu to allow you to transcode files
in your collection. When doing the latter, the transcoded file will
be written to the same directory as the original file.

You can configure dirtyxcode by creating a file in your home
directory ~/.dirtyxcode.sh. The format of the configuration is
a shell script that will be sourced by dirtyxcode. You can use
this to control how dirtyxcode constructs the gstreamer pipeline.
For example, to change the flacencoder element add the following:

flac_enc="myflacencoder myflacencopt=foo"

You can also add options to the existing encoders by setting
_enc_options, for example to change the preset quality
setting for the mp3 encoder (lame), add the following to your
~/.dirtyxcode.sh file.

mp3_enc_options="preset=extreme"

You will need gstreamer installed with appropriate plugins. dirtyxcode
will attempt to locate the gst-launch binary on startup from your path.
You can also configure the location by setting the GST_LAUNCH variable
in your ~/dirtyxcode.sh file.

The default gstreamer plugins used by dirtyxcode are:

wav: wavenc
mp3: lame
ogg: vorbisenc
m4a: faac
aac: faac
flac: flacenc
Last changelog:

12 years ago

Version 0.3
* Fixed bug where an extraneous -p was passed to gst-launch
* Better location of gst-launch binary on platforms other than Debian/Ubuntu

Version 0.2

* Fixed a bug where file containing "&" was not properly unescaped.
* Added better support for arbitry URI escapes in filenames (requires Perl and URI:Escape module - if not present will fallback to old sed scheme).
* Renamed installation file so that newer version will overwrite older ones. People upgrading from 0.1 will need to uninstall 0.1 manually.

foxmatt

12 years ago

I couldn't get the script to transcode to vorbis and put it in the ogg wrapper.

I fixed this by running a slightly modified gstlaunch command if ogg is selected as the format it adds the ogg wrapper parameter.

Anyone else have this problem, or have I made an elaborate workaround to a non existent problem?

Report

C

deanpovey

12 years ago

I don't use ogg much so I haven't run across any problems :-).

What parameters did you need to add?

Also did you do this by using the ogg_enc_options in ~/.dirtyxcode or did you hack the script.

Report

foxmatt

12 years ago

Just hacked the main script file:

Added the oggmux parameter, you could possibly add the parameter to the options in the file in you home folder by appending "! oggmux" to it.

For the default vorbis options, not read from the file, I changed the line:

error=`gst-launch filesrc location="$file" ! decodebin ! audioconvert ! audioresample ! $encoder ! filesink location="$outfile" 2>&1`

to this:

if [ $format = ogg ];
then
error=`gst-launch filesrc location="$file" ! decodebin ! audioconvert ! audioresample ! vorbisenc ! oggmux ! filesink location="$outfile" 2>&1`
else
error=`gst-launch filesrc location="$file" ! decodebin ! audioconvert ! audioresample ! $encoder ! filesink location="$outfile" 2>&1`
fi

Report

Eddi3

12 years ago

Firstly, there was no gst-launch executable in my system. There was, however, a gst-launch-0.10 executable. I simply made a system link, but I think your script could just check for gst-launch*

Another bug was that gst-launch didn't accept the "gst-launch -p filesrc ..." syntax. I looked up the man page, and all I had to do was change that to "gst-launch filesrc ..." simply removing the -p option.

Other then that, great plugin, thanks!

Report

Eddi3

12 years ago

Firstly, there was no gst-launch executable in my system. There was, however, a gst-launch-0.10 executable. I simply made a system link, but I think your script could just check for gst-launch*

Another bug was that gst-launch didn't accept the "gst-launch -p filesrc ..." syntax. I looked up the man page, and all I had to do was change that to "gst-launch filesrc ..." simply removing the -p option.

Other then that, great plugin, thanks!

Report

C

deanpovey

12 years ago

Thanks. I use Ubuntu which has a gst-launch wrapper that works around some of the versioning problems - which is why I probably didn't catch this sooner. I will have a look and see if I can handle this a little better.

Report

C

deanpovey

12 years ago

This is now fixed (hopefully) in version 0.3

Report

Niko

12 years ago

there seem to be problems with chars like '&'.

I tried this:
1) Take some .ogg file and move to directory "Test Me"
2) Add file to amarok and convert with script => works great ;-)

Then i tried the following:
1) Take the same .ogg file and move to directory "Test & Me"
2) Add file to amarok and convert with script => error occurs!

Error message in amarok was that ressource could not be found...

... is this a bug which would take a long time to fix, or could you fix it for me?

Another thing that would be great to make this script even better:
- Add a preferences dialog to specify an output folder so that the transcoded files would not be stored in the same folder as the original file (if format does not change it would be a good idea to just copy the file to the folder). This would ease creation of cds (with or withour transcoding! K3b has some similiar featurefor .mp3 files, but it is much easier to search music files in amarok then it is in k3b)

Report

C

deanpovey

12 years ago

Should be fixed in 0.2 release. Thanks again.

Report

Niko

12 years ago

The fix works great.
Thanks for the great support :)

Report

C

deanpovey

12 years ago

Hi thanks for pointing this out. This is fairly simple to fix:

Look for the line in the dirtyxcode
file that looks like:

s,%26,&,gi

and replace it with:

s,%26,\&,gi

I will probably get round to fixing this and uploading a new version in the next day or so.

Adding preference for output folder is a good idea, although a little tricky to do from a shell script :-).

Report

12 years ago

Version 0.3
* Fixed bug where an extraneous -p was passed to gst-launch
* Better location of gst-launch binary on platforms other than Debian/Ubuntu

Version 0.2

* Fixed a bug where file containing "&" was not properly unescaped.
* Added better support for arbitry URI escapes in filenames (requires Perl and URI:Escape module - if not present will fallback to old sed scheme).
* Renamed installation file so that newer version will overwrite older ones. People upgrading from 0.1 will need to uninstall 0.1 manually.

12345678910
product-maker Base: 4 x 5.0 Ratings
Be the first to comment
File (click to download) Version Description Downloads Date Filesize DL OCS-Install MD5SUM
*Needs pling-store or ocs-url to install things
Pling
0 Affiliates
Details
license
version
0.3
updated Jan 30 2008
added Jun 01 2007
downloads 24h
0
mediaviews 24h 0
pageviews 24h 1
System Tags addon