[Solved] flac>m4a

Need help? Post your questions here.

Moderator: moderators

[Solved] flac>m4a

Postby hyatari » Sat Dec 18, 2010 2:17 am

Can anyone tell me the commands to transcode flac to m4a? Mainly for use on android device. Also is it necessary to change the downsample command as well?

Thanks.
hyatari
 
Posts: 53
Joined: Thu Jan 28, 2010 11:56 pm

Postby GJ51 » Sat Dec 18, 2010 4:18 am

Stozher's the man when it comes to transcoding! Here's his suggetions.

One step with a fixed bit rate (all tags transferred to MP3)

Step 1: ffmpeg -i %s -f mp3 -ar 44100 -ab 320k -ac 2 -map_meta_data 0:0 -
Step 2: none (blank)

or two step transcoding (above is a better choice)

Step 1: ffmpeg -i %s -f wav -ar 44100 -ac 2 -
Step 2: lame --preset cbr %b -S --tt %t --ta %a --tl %l - -

See also http://forum.subsonic.org/forum/viewtop ... 7540#17540

PP: Mark check boxes right from Step 3 and check players settings (log as admin to see all players).


Pasted from

http://forum.subsonic.org/forum/viewtopic.php?t=4914
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 stozher » Sat Dec 18, 2010 4:39 am

FLAC > M4A (AAC):

flac > m4a (aac) | flac | m4a | ffmpeg -i %s -f flv -vn -acodec libfaac -ar 44100 -aq 500 -ac 2 -map_meta_data 0:0 - |

Step 2 is a blank (none). See also http://forum.subsonic.org/forum/viewtop ... 8197#18197 and next post for ABR testing.

Test on my server (see link in my profile). Currently I use VBR and quality is a better... also on my server sample rate is a 48 kHz (-ar 48000).
http://music.stozher.com:8080/login.view?user=guest&password=
User avatar
stozher
 
Posts: 313
Joined: Tue Nov 16, 2010 10:56 am
Location: Sofia, Bulgaria

Postby GJ51 » Sat Dec 18, 2010 5:30 am

Thanks Stozher!

No doubt I really need to educate myself more on the whole transcoding subject.

There's also no doubt that your site sounds fantastic. Great quality. Many thanks for all your contributions!
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 hyatari » Sat Dec 18, 2010 4:03 pm

is this meant to work on android? i keep getting an I/O error when trying to play flac now on device. it shows the flac > m4a when looking through flac files but wont play anything. ive disabled the flac > mp3 made flac > m4a defualt and checked the boxes for the player. i tried the 48000 and 44100.
hyatari
 
Posts: 53
Joined: Thu Jan 28, 2010 11:56 pm

Postby GJ51 » Sat Dec 18, 2010 4:14 pm

I can stream to my phone when connected to Stozher's site.
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 hyatari » Sat Dec 18, 2010 4:32 pm

ok its working with the 2 step method you posted previously. thanks. this is a cbr it appears. i would like to get the vbr method working if possible. basically i want the highest quality with lowest bitrate/least amount of bandwidth i can achieve.
hyatari
 
Posts: 53
Joined: Thu Jan 28, 2010 11:56 pm

Postby stozher » Sat Dec 18, 2010 5:16 pm

FLAC > MP3 (VBR):

Step 1: ffmpeg -i %s -f wav -acodec pcm_s16le -ar 44100 -ac 2 -
Step 2: lame --preset extreme -S --tt %t --ta %a --tl %l - -

--preset medium - this preset should provide near transparency to most people on most music;
--preset standard - this preset should generally be transparent to most people on most music and is already quite high in quality;
--preset extreme - if you have extremely good hearing and similar equipment, this preset will generally provide slightly higher quality than the standard mode.


Step 1: ffmpeg -i %s -f wav -acodec pcm_s16le -ar 44100 -ac 2 -
Step 2: lame -v --vbr-new -B %b -S --tt %t --ta %a --tl %l - -

-B %b - specifies the maximum allowed bitrate from SS Settings / Players. Always specify different from "No limit" in Setting / Users ("No limit" for lame is a default = 128k; for ffmpeg is a default = 64k).


Step 1: ffmpeg -i %s -f wav -acodec pcm_s16le -ar 44100 -ac 2 -
Step 2: lame -v --vbr-new -V 0 -S --tt %t --ta %a --tl %l - -

Step 1: ffmpeg -i %s -f mp3 -acodec libmp3lame -ar 44100 -aq 0 -ac 2 -map_meta_data 0:0 -
Step 2: none (blank)

VBR quality (default = 4). In this mode, you choose the desired quality on a scale from 9 (lowest quality/biggest distortion) to 0 (highest quality/lowest distortion).
Last edited by stozher on Sat Dec 18, 2010 9:12 pm, edited 1 time in total.
http://music.stozher.com:8080/login.view?user=guest&password=
User avatar
stozher
 
Posts: 313
Joined: Tue Nov 16, 2010 10:56 am
Location: Sofia, Bulgaria

Postby stozher » Sat Dec 18, 2010 5:53 pm

hyatari, you need to upgrade FFmpeg (see "--enable-libfaac" and other built-in configuration options in my version):

Code: Select all
stozher@stozher:~$ ffmpeg
FFmpeg version SVN-r25838, Copyright (c) 2000-2010 the FFmpeg developers
  built on Nov 29 2010 15:39:30 with gcc 4.4.5
  configuration: --enable-libdc1394 --prefix=/usr --extra-cflags='-Wall -g ' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-avfilter --enable-libdirac --disable-decoder=libdirac --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-libvpx --enable-librtmp --extra-libs=-lgcrypt --disable-altivec --disable-armv5te --disable-armv6 --disable-vis
  libavutil     50.33. 0 / 50.33. 0
  libavcore      0.14. 0 /  0.14. 0
  libavcodec    52.97. 2 / 52.97. 2
  libavformat   52.87. 1 / 52.87. 1
  libavdevice   52. 2. 2 / 52. 2. 2
  libavfilter    1.65. 0 /  1.65. 0
  libswscale     0.12. 0 /  0.12. 0
  libpostproc   51. 2. 0 / 51. 2. 0
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'


EDIT: I tested on Motorola Milestone and AAC included in FLV container don't work. Next days I check with other container formats...
http://music.stozher.com:8080/login.view?user=guest&password=
User avatar
stozher
 
Posts: 313
Joined: Tue Nov 16, 2010 10:56 am
Location: Sofia, Bulgaria

Postby gabbott » Thu Dec 30, 2010 5:06 pm

stozher,
You seem to be pretty knowledgeable with transcoding. Looking for some help. I'm running subsonic on an unraid box (basically slackware distro) and trying to get flac to ogg transcoding working to my android device. I've got it working but no matter what I try I can't get tags on the transcoded files.

Code: Select all

root@Media02:/boot/subsonic/data/transcode# ffmpeg
FFmpeg version 0.6, Copyright (c) 2000-2010 the FFmpeg developers
  built on Jun 18 2010 17:09:12 with gcc 4.4.4
  configuration: --prefix=/usr --libdir=/usr/lib --shlibdir=/usr/lib --mandir=/usr/man --enable-gpl --enable-version3 --enable-postproc --enable-avfilter --enable-libdc1394 --enable-libfaad --enable-libgsm --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libx264 --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --disable-vdpau --enable-memalign-hack --enable-pthreads --enable-x11grab --enable-bzlib --enable-zlib --enable-shared --enable-static --disable-debug --extra-cflags='-I/tmp/build/tmp-ffmpeg/ffmpegdeps/usr/include -DRUNTIME_CPUDETECT' --extra-ldflags='-L/tmp/build/tmp-ffmpeg/ffmpegdeps/usr/lib -lssl -lcrypto -lz -lusb'
  libavutil     50.15. 1 / 50.15. 1
  libavcodec    52.72. 2 / 52.72. 2
  libavformat   52.64. 2 / 52.64. 2
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1.19. 0 /  1.19. 0
  libswscale     0.11. 0 /  0.11. 0
  libpostproc   51. 2. 0 / 51. 2. 0
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'



Code: Select all

root@Media02:/boot/subsonic/data/transcode# oggenc -h
oggenc from vorbis-tools 1.3.0 by the Xiph.Org Foundation (http://www.xiph.org/)



Here is what I'm using for transcoding (just one step)

oggenc -Q -q 4.5 %s -o -
gabbott
 
Posts: 17
Joined: Tue Nov 30, 2010 12:17 am
Location: US

Postby stozher » Thu Dec 30, 2010 8:10 pm

FLAC > OGG:

ffmpeg -loglevel error -v 0 -i %s -f ogg -acodec flac -ar 44100 -aq 4.5 -ac 2 -map_meta_data 0:0 -

ffmpeg -loglevel error -v 0 -i %s -f ogg -acodec libvorbis -ar 44100 -aq 4.5 -ac 2 -map_meta_data 0:0 -

For "-aq" option value see "Wikipedia: Vorbis - Technical details". If you specify only "-f ogg" (not "-acodec") FFmpeg use "-acodec vorbis" - better variant is a libvorbis. Option "-map_meta_data 0:0" used to transfer vorbis tags from FLAC to OGG.


oggenc %s -Q -q 4.5 --resample 44100 -a %a -t %t -l %l -o -

-q n, --quality=n

Sets encoding quality to n, between -1 (very low) and 10 (very high). This is the default mode of operation, with a default quality level of 3. Fractional quality levels such as 2.5 are permitted. Using this option allows the encoder to select an appropriate bitrate based on your desired quality level.
Last edited by stozher on Fri Dec 31, 2010 4:26 pm, edited 1 time in total.
http://music.stozher.com:8080/login.view?user=guest&password=
User avatar
stozher
 
Posts: 313
Joined: Tue Nov 16, 2010 10:56 am
Location: Sofia, Bulgaria

Postby gabbott » Thu Dec 30, 2010 10:15 pm

stozher wrote:FLAC > OGG:

ffmpeg -loglevel error -v 0 -i %s -f ogg -acodec flac -ar 44100 -aq 4.5 -ac 2 -map_meta_data 0:0 -

ffmpeg -loglevel error -v 0 -i %s -f ogg -acodec libvorbis -ar 44100 -aq 4.5 -ac 2 -map_meta_data 0:0 -

For "-aq" option value see "Wikipedia: Vorbis - Technical details". If you specify only "-f ogg" (not "-acodec") FFmpeg use "-acodec vorbis" - better variant is a libvorbis. Option "-map_meta_data 0:0" used to transfer vorbis tags from FLAC to OGG.


oggenc -Q -q 4.5 --resample 44100 -o - -a %a -t %t -l %l %s

-q n, --quality=n

Sets encoding quality to n, between -1 (very low) and 10 (very high). This is the default mode of operation, with a default quality level of 3. Fractional quality levels such as 2.5 are permitted. Using this option allows the encoder to select an appropriate bitrate based on your desired quality level.


Thanks for this, I think I need to figure out how to compile ffmpeg with libvorbis.
gabbott
 
Posts: 17
Joined: Tue Nov 30, 2010 12:17 am
Location: US

Postby rgthorpe2001 » Fri Dec 31, 2010 3:06 pm

First, thanks to Stozher and other posters here in other threads I have my Subsonic server successfully transcoding tracks in flac to ogg. This is a MAJOR improvement to my Subsonic experience, as I use Subsonic to stream to an Android client, and with ogg I now have gapless (or nearly gapless) playback.

Rather than transcoding my existing mp3s and aacs with the resulting quality loss, I plan to rerip my existing cds for which I need gapless playback to flac. I understand that the optimal way to do this is to encode to a single flac file with cue sheet, rather than to a flac for each track as I have done thus far. Has anyone had success transcoding on the fly from flac plus cue, and what commands have you used? (Goggling thus far has only turned up ways to split the flac -- I would like to leave the single flac file + cue as is, and only transcode to separate oggs when called from the Android client.)
rgthorpe2001
 
Posts: 9
Joined: Wed Sep 08, 2010 4:46 pm

Postby stozher » Fri Dec 31, 2010 4:35 pm

Linux commands to transcoding track by choice from FLAC+CUE to other format isn't a big problem but SS don't see separate tracks in big FLAC file...
http://music.stozher.com:8080/login.view?user=guest&password=
User avatar
stozher
 
Posts: 313
Joined: Tue Nov 16, 2010 10:56 am
Location: Sofia, Bulgaria

Postby rgthorpe2001 » Fri Dec 31, 2010 5:33 pm

Thanks, makes sense -- I'll stick to a file for each track for my re-ripping project.
rgthorpe2001
 
Posts: 9
Joined: Wed Sep 08, 2010 4:46 pm


Return to Help

Who is online

Users browsing this forum: Google [Bot] and 8 guests