Can I limit down sampling to files above 48khz only?

General discussions.

Moderator: moderators

Can I limit down sampling to files above 48khz only?

Postby geofstro » Fri Sep 06, 2013 7:26 am

I have a number of HiRez files. I can stream all formats at up to 48khz, no problem. I can't handle the > 48khz though.

Is there any way to create a rule to downsample to 48khz in those situations; but otherwise leave the file alone; i.e. not transcode?

Seems like it should be possible. I can't see a way to do it though.

Admittedly I'm not too familiar with the ffmpeg commands.

Thanks in advance to anyone who can offer advice.

geoff
geofstro
 
Posts: 32
Joined: Sun Oct 21, 2012 3:53 pm

Re: Can I limit down sampling to files above 48khz only?

Postby GJ51 » Wed Sep 18, 2013 2:47 am

Not understood.

Downsampling normally refers to kbps where higher bitrate music is downsampled to a lower bit rate to save bandwidth. If you set the rate to 128kbps then any file with a higher bit rate gets downsampled.
Gary J

http://bios-mods.com
http://www.maplegrovepartners.com
http://theaverageguy.tv/category/tagpodcasts/cyberfrontiers/
User avatar
GJ51
 
Posts: 3492
Joined: Wed Oct 20, 2010 11:58 pm
Location: Western New York

Re: Can I limit down sampling to files above 48khz only?

Postby geofstro » Thu Sep 19, 2013 8:22 am

I'm speaking about lossless files only, so it's appropriate to speak about the sample rate; but I understand your point. Whatever a lossless flac file at 48khz translates to in kbps is what I need to down-sample to. The kbps figure varies as the file streams though, so the value which stays fixed is the sample rate.

Is there a flac transcoding command, for example that will down sample any file with a sample rate above 48khz (e.g. 96khz) down to 48khz for streaming.

Sorry; but I thought my question was clear.

geoff
geofstro
 
Posts: 32
Joined: Sun Oct 21, 2012 3:53 pm

Re: Can I limit down sampling to files above 48khz only?

Postby GJ51 » Fri Sep 20, 2013 11:44 am

I thought that may have been what you were referring to.

In the transcoding settings you will find the string that ffmpeg uses for flac > mp3. There should be a section in that string similar to "-ar 44100 -ac 2 -v 0 -f mp3 -" that reprocesses any flac down to 44100khz. It should then be that output that would be downsampled if necessary with Subsonics downsampling feature.

I don't know how else you would handle this issue.

I hope that helps a bit. Please let me know if I'm not seeing this correctly.
Gary J

http://bios-mods.com
http://www.maplegrovepartners.com
http://theaverageguy.tv/category/tagpodcasts/cyberfrontiers/
User avatar
GJ51
 
Posts: 3492
Joined: Wed Oct 20, 2010 11:58 pm
Location: Western New York

Re: Can I limit down sampling to files above 48khz only?

Postby geofstro » Fri Sep 20, 2013 6:11 pm

Thanks Gary. Wouldn't that convert to MP3 though? I'm looking for a way to leave it in flac format; but just change the sample rate, when the rate of the file is greater than 48khz.

Thanks again.

Geoff
geofstro
 
Posts: 32
Joined: Sun Oct 21, 2012 3:53 pm

Re: Can I limit down sampling to files above 48khz only?

Postby GJ51 » Fri Sep 20, 2013 7:40 pm

It's a challenging issue that I've not seen posed before. If you look at the transcoding page in Settings, you do have an option to use ffmpeg to downsample. The current string outputs mp3.

You could experiment to see if replacing "mp3" with "flac" will work. If that simple substitution works then it would only be a matter of adding a parameter (maybe -ar 48000) into the string to limit the sample rate.

I assume that you must be attempting to do this for mobile playback? I know flac is great for quality, but you might consider ogg if this is for mobile as it is very efficient and maintains very good quality depending on the parameters you use.

The only other approach would be to limit the sample rate at the player end, but I can't imagine why you'd want to do that if the data is already to the player.

I have a dedicated mobile server that only outputs ogg that I set up to take advantage of the better performance in lower bandwidth connection environments. It is currently adjusted for around 100kbps for some of my mobile users to keep thier data usage reasonable. I'd be happy to give you access and adjust the data rate for you to a higher quality to see if that might be a better solution for you.
Gary J

http://bios-mods.com
http://www.maplegrovepartners.com
http://theaverageguy.tv/category/tagpodcasts/cyberfrontiers/
User avatar
GJ51
 
Posts: 3492
Joined: Wed Oct 20, 2010 11:58 pm
Location: Western New York

Postby daneren2005 » Fri Sep 20, 2013 7:50 pm

Not to hijack the thread, but mind sharing the ogg line you use? I've considering switching to it before, but haven't felt like researching a good transcoding string.

Sent from my HTC One X using Tapatalk 4
Developer of DSub for Android
daneren2005
 
Posts: 1709
Joined: Fri Jul 06, 2012 7:52 pm

Re: Can I limit down sampling to files above 48khz only?

Postby GJ51 » Fri Sep 20, 2013 7:56 pm

ffmpeg -v 0 -i %s -f ogg -vn -acodec libvorbis -ar 44100 -aq 3 -ac 1 -map_meta_data 0:0 -

Never a problem :) adjust the number after -aq to adjust quality, higher = better. Wikipedia has a reasonable approximation chart that converts settings to bitrate.

EDIT: ffmpeg -v 0 -i %s -f ogg -vn -acodec libvorbis -ar 44100 -aq 3 -ac 2 -map_meta_data 0:0 -

"-ac 2" enables 2 channels, sorry for the original.

Just looked at logs during playback and this is working fine for me. One thing that needs to be understood is that ogg doesn't just spit back a lower bitrate but varies bitrate based on the data being sampled. You can find 2 different tracks, both at 320kbps in the original format, but if one is full orchestra and the other is a solo acapella, the orchestration will use noticibly more bit rate.

Playing random tracks at the same settings -aq 3 I see anything from 80 - 120 kbps in the logs. Wikipedia has good explanations of how this works.

[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) Input #0, mp3, from '\\MAPLEGROVE-DC\Music\Music\Florence + the Machine\Lungs\Florence + the Machine - Lungs - 13 - Youve Got The Love.mp3':
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) Metadata:
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) TPE1 : Florence + the Machine
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) TALB : Lungs
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) TPE2 : Florence + the Machine
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) TIT2 : Youve Got The Love
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) TPUB : Universal Republic
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) TRCK : 13
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) TYER : 2009
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) TDRC : 2009
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) Duration: 00:02:48.04, start: 0.000000, bitrate: 138 kb/s
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) Stream #0.0: Audio: mp3, 44100 Hz, 2 channels, s16, 32 kb/s
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) Output #0, ogg, to 'pipe:':
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) Metadata:
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) artist : Florence + the Machine
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) album : Lungs
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) TPE2 : Florence + the Machine
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) title : Youve Got The Love
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) publisher : Universal Republic
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) track : 13
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) TYER : 2009
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) TDRC : 2009
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) Stream #0.0: Audio: vorbis, 44100 Hz, 2 channels, s16, 64 kb/s
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) Stream mapping:
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) Stream #0.0 -> #0.0
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) Press [q] to stop encoding
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) [mp3 @ 003e9200]Header missing
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) Error while decoding stream #0.0
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) size= 2454kB time=168.03 bitrate= 119.6kbits/s
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg)
[9/20/13 4:43:01 PM EDT] DEBUG InputStreamReaderThread (c:\subsonic\transcode\ffmpeg) video:0kB audio:2108kB global headers:4kB muxing overhead 16.197202%
The complete log is saved in c:\subsonic\subsonic.log.
Last edited by GJ51 on Fri Sep 20, 2013 8:45 pm, edited 2 times in total.
Gary J

http://bios-mods.com
http://www.maplegrovepartners.com
http://theaverageguy.tv/category/tagpodcasts/cyberfrontiers/
User avatar
GJ51
 
Posts: 3492
Joined: Wed Oct 20, 2010 11:58 pm
Location: Western New York

Re: Can I limit down sampling to files above 48khz only?

Postby mr_nobody » Fri Sep 20, 2013 8:00 pm

Yet another hijack! :wink: It is absolutely essential to use libvorbis. The vorbis encoder that ffmpeg defaults to encodes everything at 64kbps no matter what you tell it to for no apparent reason. :roll:
mr_nobody
 
Posts: 202
Joined: Thu May 31, 2012 8:17 pm

Re: Can I limit down sampling to files above 48khz only?

Postby GJ51 » Fri Sep 20, 2013 9:31 pm

Hijackers everywhere! :lol:

Let's just hope we've given the OP some things that might help.
Gary J

http://bios-mods.com
http://www.maplegrovepartners.com
http://theaverageguy.tv/category/tagpodcasts/cyberfrontiers/
User avatar
GJ51
 
Posts: 3492
Joined: Wed Oct 20, 2010 11:58 pm
Location: Western New York

Re: Can I limit down sampling to files above 48khz only?

Postby daneren2005 » Fri Sep 20, 2013 11:13 pm

Sweet, I went ahead and put that in for experimentation later. I definitely notice nasty audio quality at 128 kpbs mp3, so hopefully this will provide an improvement without using more space :D
Developer of DSub for Android
daneren2005
 
Posts: 1709
Joined: Fri Jul 06, 2012 7:52 pm


Return to General

Who is online

Users browsing this forum: No registered users and 3 guests