Re: Re: Can Netjuke create MP3s on the fly?
Will Meyer <[email protected]>
| Newsgroups | gmane.comp.audio.netjuke.user |
|---|---|
| Message-ID | <3446660.1048256379702.JavaMail.nobody@wamui02.slb.atl.earthlink.net> |
Cool, that was fast -- will give it a shot, but the basic idea seems straightforward. Thanks! Will -------Original Message------- From: Matthias Mikuletz <[email protected]> Sent: 03/21/03 09:11 AM To: [email protected], WillMeyer <[email protected]> Subject: Re: [Netjuke-users] Can Netjuke create MP3s on the fly? > > Will Meyer <[email protected]> schrieb am 21.03.03 14:45:45: > > My music collection is all FLAC, which I listen to directly at home. If I set up Netjuke, is there a way to > configure it to generate MP3s from FLAC dyamically, maybe pre-caching whole albums or something but in > essence a way to keep a lossless format for most purposes and just get it to stream out MP3s for listening > over lower-bandwith WAN connections? Is the code set up to be able to write a plugin for such without too > much trouble? Hi Will, I have used a former hint from the mailing list to set up netjuke to transcode mp3's on the fly to a lower bitrate for a single user. In this setup you can easily replace the 'transcode' thing with an 'encode' thing. Well, as long as your machine is powerful enough. And if you like to have it be done unconditionally, you can just leave out the bit with the user; and you would have to replace the *.mp3 with *.flc or whatever the suffix for FLAC's is. It goes like this: diff netjuke/play.php netjuke/play.php.orig : 88,101c88,91 < < # this is disabled - we go for resampling < # if (!strstr($tr_location,"://")) $tr_location = WEB_PATH."/".$tr_location; < < # new code < if (($NETJUKE_SESSION_VARS["email"] == "[email protected]") && (strstr($tr_location,".mp3"))) { < if (!strstr($tr_location,"://")) $tr_location = WEB_PATH."/playmp3.php?mp3file=".$tr_location; < $tr_location = separatorCleanup($tr_location); < } < else { < if (!strstr($tr_location,"://")) $tr_location = WEB_PATH."/".$tr_location; < $tr_location = separatorCleanup($tr_location); < } < --- > if (!strstr($tr_location,"://")) $tr_location = WEB_PATH."/".$tr_location; > > $tr_location = separatorCleanup($tr_location); Basically this just calls playmp3.php with the approriate parameter if the user name is as specified and the file is an MP3. Additionally you need netjuke/playmp3.php which goes like this: <? $filename = $_REQUEST['mp3file']; $bitrate = 64; // desired streaming bitrate header("Content-type: audio/mp3"); set_time_limit(1800); // maximum length of a song echo passthru("/usr/bin/lame -b $bitrate -f --silent \"/srv/www/netjuke/$filename\" - "); ?> Here you can see the transcoding command. Just replace it with anything appropriate. (Maybe you' ll have to de-flac and then encode to mp3 in a pipe.) Have fun Matthias ps Just drop me an e-mail if you've got some question on the above. ______________________________________________________________________________ Sie haben mehr zu sagen als in eine SMS passt? Mit WEB.DE FreeMail ist das jetzt kein Problem mehr! <a target=_blank href="http://freemail.web.de/features/?mc=021182">http://freemail.web.de/features/?mc=021182</a> ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. <a target=_blank href="http://thinkgeek.com/sf">http://thinkgeek.com/sf</a> _______________________________________________ Netjuke-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/netjuke-users > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf