View previous topic :: View next topic |
Author |
Message |
hakova New Member

Joined: 03 Feb 2025 Posts: 40 Location: Virginia
|
Posted: Tue Mar 31, 2025 3:09 am Post subject: [SOLVED] transcoding aac stream to mp3 on the fly via vlc |
|
|
Hi there,
I posted the same question in vlc forum as well, but that forum is not very active and I thought some one here might have some experience or suggestions.
I have a receiver with a network card that can play back mp3 but not aac streams. There are a couple of internet radio channels I like, which stream aac only. I want to utilize vlc to get the stream via http protocol, transcode it to mp3 on the fly and re-stream it to my LAN. I have vlc 0.8.6c on my media server. The following command line is supposed to do the job:
Code: | vlc -vvv http://xx.xx.xxx.x:8875/ --sout '#transcode{acodec=mp3,ab=192,channels=2}:duplicate{dst=std{access=http,mux=raw,dst=8091}}' |
It creates the stream which is in slow motion! If you play it back with a vlc client, you can simply double the playback rate and it is back to normal; however if you use a receiver like me, then there is no adjustable playback speed, you are stuck with a slow (1/2 normal speed) playback.
I believe this is a bug, which has been reported for videos with transcoded mp3 streams, etc. I used a newer version of vlc (0.9.3 Grishenko) on my desktop, but this one only produced modem noise instead of a stream, therefore the bug not only was not fixed but got worse I guess.
Here are my questions:
Does anybody know any fix to this behavior?
Is there any other way to transcode an aac stream to mp3 on the fly?
If no to both questions, then a workaround for this issue might be transcoding the mp4/aac stream to a local mp3 file and then streaming from it, instead of doing it on the fly. In this case scenario, there has to be a certain delay in playback (which is fine) and a file size limit to avoid using valuable HDD space in GBs. Can any one point me to the right direction of how to rotate local mp3 file(s)? For example, if I have 3 mp3 files used as some kind of a cache, the first one gets deleted as the third one is created and written to, and the second one will be played back. Then second one then will be rotated to the first one once the playback finishes, the third one will become the second one and therefore will start to be played back, while a new third mp3 file will be written synchronously.
I just don't have the required programming background to put something together like this, and any help will be greatly appreciated. Of course this third option will introduce undesired interruptions in the middle of songs for example, so it really is a last resort, unless there is no fix for transcoding on the fly.
Regards,
Hakan
Last edited by hakova on Thu Apr 09, 2025 5:05 am; edited 1 time in total |
|
Back to top |
|
hakova New Member

Joined: 03 Feb 2025 Posts: 40 Location: Virginia
|
Posted: Sat Apr 04, 2025 2:55 am Post subject: |
|
|
OK, let's try a different approach. Does anybody know a tool that can read an aac/mp4 stream and redirects it to standard output? Mplayer is supposed to do this but my rpm-based version was not compiled with faad2 support and I don't want to try compiling it from the source. I did some googling but couldn't really find anything like that. Vlc does not seem to redirect its output to stout. If I can find such a tool, next thing I will try will be something like this:
Code: | mplayer http://xx.xx.xxx.x:8875 - | faad -f 2 -w | lame - - | some-kind-of-streaming-command-here
|
This will not only let me listen to live Turkish radio in Virginia, but also save me from doing it via an audio cable from my box to the receiver downstairs.
|
|
Back to top |
|
inactive Sr. Member
Joined: 29 Aug 2025 Posts: 1207
|
Posted: Sat Apr 04, 2025 6:02 am Post subject: |
|
|
hakova, is this for Mandriva? If so I may have an idea.
_________________ Mandriva 2025.1 PWP
Mandriva Cooker
ArtistX live
|
|
Back to top |
|
hakova New Member

Joined: 03 Feb 2025 Posts: 40 Location: Virginia
|
Posted: Sat Apr 04, 2025 8:28 pm Post subject: |
|
|
DedannaRocks! wrote: | hakova, is this for Mandriva? If so I may have an idea. |
Yes it is! I am very interested in hearing what it might be?
|
|
Back to top |
|
hakova New Member

Joined: 03 Feb 2025 Posts: 40 Location: Virginia
|
Posted: Tue Apr 07, 2025 1:42 am Post subject: |
|
|
Here is my final conclusion about this issue, in case anybody else is trying. In summary, when you record an mp4a stream, it is unreadable until the recording stops. That is probably because a moov box/atom is added only after completion of the recording process. That makes piping of mp4 files practically impossible, since decoders do not recognize the pipe in mp4 format without the moov box/atom in place.
Here is a link on this issue from vlc forums.
Regards.
|
|
Back to top |
|
inactive Sr. Member
Joined: 29 Aug 2025 Posts: 1207
|
|
Back to top |
|
inactive Sr. Member
Joined: 29 Aug 2025 Posts: 1207
|
Posted: Tue Apr 07, 2025 4:04 am Post subject: |
|
|
Actually... just in case you haven't got it covered:
Code: | [dedanna@dedanna ~]$ rpm -qa | grep aad
faad2-2.6.1-2plf2008.1
gstreamer0.10-faad-0.10.6-5plf2008.1
faad2-xmms-2.6.1-2plf2008.1
libfaad2_0-2.6.1-2plf2008.1
[dedanna@dedanna ~]$ urpmq -i faad2-2
Name : faad2
Version : 2.6.1
Release : 2plf2008.1
Group : Sound
Size : 55389 Architecture: i586
Source RPM : faad2-2.6.1-2plf2008.1.src.rpm
URL : http://www.audiocoding.com
Summary : Freeware Advanced Audio Decoder version 2
Description :
FAAD 2 is a LC, MAIN and LTP profile, MPEG2 and MPEG-4 AAC decoder,
completely written from scratch. FAAD 2 is licensed under the GPL.
This package is in PLF because MPEG is covered by software patents. |
Code: | [dedanna@dedanna ~]$ rpm -qa | grep aac
libfaac0-1.26-2plf2008.1
faac-1.26-2plf2008.1
gstreamer0.10-faac-0.10.6-5plf2008.1
[dedanna@dedanna ~]$ urpmq -i faac
Name : faac
Version : 1.26
Release : 2plf2008.1
Group : Sound
Size : 114731 Architecture: i586
Source RPM : faac-1.26-2plf2008.1.src.rpm
URL : http://www.audiocoding.com
Summary : Freeware Advanced Audio Encoder
Description :
FAAC is an AAC encoder based on the ISO MPEG-4 reference code.
This package is in PLF, as the MPEG-4 format is covered by software patents. |
Code: | [dedanna@dedanna ~]$ urpmq -i transcode
Name : transcode
Version : 1.0.5
Release : 4plf2008.1
Group : Video
Size : 5925680 Architecture: i586
Source RPM : transcode-1.0.5-4plf2008.1.src.rpm
URL : http://www.transcoding.org
Summary : A linux video stream processing utility
Description :
transcode is a text-console video stream processing
tool. Decoding and encoding is done by loading shared library modules
that are responsible for feeding transcode with raw RGB/PCM streams
(import module) and encoding the frames (export module). It supports
elementary video and audio frame transformations.
Some example modules are included to enable import
of MPEG program streams (VOB), Digital Video (DV), or YUV video
and export modules for writing DivX;-), OpenDivX, or uncompressed AVI files.
A set of tools is available to extract and decode the sources into
raw video/audio streams for import and to enable post-processing of AVI files.
This package is in PLF as it could violate some patents. |
I'm not sure that these will help, but I'm throwing them out there.
_________________ Mandriva 2025.1 PWP
Mandriva Cooker
ArtistX live
|
|
Back to top |
|
inactive Sr. Member
Joined: 29 Aug 2025 Posts: 1207
|
Posted: Tue Apr 07, 2025 4:06 am Post subject: |
|
|
Sorry, one more (no, two):
Code: | [dedanna@dedanna ~]$ transcode --help
transcode v1.0.5 (C) 2025-2003 Thomas Oestreich, 2025-2004 T. Bitterberg, 2025-2008 Transcode Team
Usage: transcode [options]
options:
-i name input file/directory/device/mountpoint/host name
-H n auto-probe n MB of source (0=off) [1]
-p file read audio stream from separate file [off]
-x vmod[,amod] video[,audio] import modules [null]
-a a[,v] extract audio[,video] track [0,0]
--dvd_access_delay N delay DVD access by N seconds [3]
-e r[,b[,c]] PCM audio stream parameter [48000,16,2]
-E r[,b[,c]] audio output samplerate, bits, channels [as input]
-n 0xnn import audio format id [0x2000]
-N 0xnn export audio format id [0x55]
-b b[,v[,q[,m]]] audio encoder bitrate kBits/s[,vbr[,quality[,mode]]] [128,0,5,0]
--no_audio_adjust disable audio frame sample adjustment [off]
--no_bitreservoir disable lame bitreservoir [off]
--lame_preset name[,fast] use lame preset with name. [off]
-g wxh RGB video stream frame size [720x576]
--import_asr C set import display aspect ratio code C [auto]
--export_asr C set export display aspect ratio code C [as input]
--export_par N,D set export pixel aspect ratio [auto]
--keep_asr try to keep aspect ratio (only with -Z) [off]
-f rate[,frc] input video frame rate[,frc] [25.000,0] fps
--export_fps f[,c] output video frame rate[,code] [as input] [25.000,3]
--export_frc F set export frame rate code F [as input]
--hard_fps disable smooth dropping (for variable fps clips) [off]
-o file output file name
-m file write audio stream to separate file [off]
-y vmod[,amod] video[,audio] export modules [null]
-F codec encoder parameter strings [module dependent]
--avi_limit N split output AVI file after N MB [2048]
--avi_comments F Read AVI header comments from file F (see transcode(1)) [off]
-d swap bytes in audio stream [off]
-s g[,c[,f[,r]]] increase volume by gain,[center,front,rear] [off,1,1,1]
-u m[,n] use m framebuffer[,n threads] for AV processing [10,1]
-A use AC3 as internal audio codec [off]
-V use YV12/I420/YUV420 as internal video format [deprecated, default]
--use_rgb use RGB as internal video format [off]
--uyvy use UYVY/YUV422 as internal video format [off]
-J f1[,f2[,...]] apply external filter plugins [off]
-P flag pass-through flag (0=off|1=V|2=A|3=A+V) [0]
-D num sync video start with audio frame num [0]
--av_fine_ms t AV fine-tuning shift t in millisecs [autodetect]
-M mode demuxer PES AV sync mode (0=off|1=PTS only|2=full) [1]
-O flush lame mp3 buffer on encoder stop [off]
-r n[,m] reduce video height/width by n[,m] [off]
-B n[,m[,M]] resize to height-n*M rows [,width-m*M] columns [off,32]
-X n[,m[,M]] resize to height+n*M rows [,width+m*M] columns [off,32]
-Z wxh[,fast] resize to w columns, h rows with filtering [off,notfast]
--zoom_filter str use filter string for video resampling -Z [Lanczos3]
-C mode enable anti-aliasing mode (1-3) [off]
--antialias_para w,b center pixel weight, xy-bias [0.333,0.500]
-I mode enable de-interlacing mode (1-5) [off]
-K enable b/w mode [off]
-G val gamma correction (0.0-10.0) [off]
-z flip video frame upside down [off]
-l mirror video frame [off]
-k swap red/blue (Cb/Cr) in video frame [off]
-j t[,l[,b[,r]]] select frame region by clipping border [off]
-Y t[,l[,b[,r]]] select (encoder) frame region by clipping border [off]
--pre_clip t[,l[,b[,r]]] select initial frame region by clipping border [off]
--post_clip t[,l[,b[,r]]] select final frame region by clipping border [off]
-w b[,k[,c]] encoder bitrate[,keyframes[,crispness]] [1800,250,100]
--video_max_bitrate maximum bitrate when encoding variable bitrate MPEG-2 streams [same as -w]
-R n[,f1[,f2]] enable multi-pass encoding (0-3) [0,divx4.log,pcm.log]
-Q n[,m] encoding[,decoding] quality (0=fastest-5=best) [5,5]
--divx_quant min,max divx encoder min/max quantizer [2,31]
--divx_rc p,rp,rr divx encoder rate control parameter [2000,10,20]
--divx_vbv_prof N divx5 encoder VBV profile (0=free-5=hiqhq) [3]
--divx_vbv br,sz,oc divx5 encoder VBV params (bitrate,size,occup.) [10000,192,36864]
-c f1-f2[,f3-f4] encode only f1-f2[,f3-f4] (frames or HH:MM:SS) [all]
-t n,base split output to base%03d.avi with n frames [off]
--dir_mode base process directory contents to base-%03d.avi [off]
--frame_interval N select only every Nth frame to be exported [1]
-U base process DVD in chapter mode to base-ch%02d.avi [off]
-T t[,c[-d][,a]] select DVD title[,chapter(s)[,angle]] [1,1,1]
-W n,m[,file] autosplit and process part n of m (VOB only) [off]
--cluster_percentage use percentage mode for cluster encoding -W [off]
--cluster_chunks a-b process chunk range instead of selected chunk [off]
-S unit[,s1-s2] process program stream unit[,s1-s2] sequences [0,all]
-L n seek to VOB stream offset nx2kB [0]
--import_v4l n[,id] channel number and station number or name [0]
--pulldown set MPEG 3:2 pulldown flags on export [off]
--encode_fields enable field based encoding (if supported) [off]
--nav_seek file use VOB navigation file [off]
--psu_mode process VOB in PSU, -o is a filemask incl. %d [off]
--psu_chunks a-b process only selected units a-b for PSU mode [all]
--no_split encode to single file in chapter/psu mode [off]
--ts_pid 0xnn transport video stream pid [0]
--a52_drc_off disable liba52 dynamic range compression [enabled]
--a52_demux demux AC3/A52 to separate channels [off]
--a52_dolby_off disable liba52 dolby surround [enabled]
--print_status N[,r] print status every N frames / use CR or NL [1,1]
--progress_off disable progress meter status line [off]
--color N level of color in transcodes output [1]
--write_pid file write pid of signal thread to "file" [off]
--nice N set niceness to N [off]
--accel type enforce IA32/AMD64 acceleration for type [autodetect]
--socket file socket file for run-time control [no file]
--dv_yuy2_mode libdv YUY2 mode (default is YV12) [off]
--config_dir dir Assume config files are in this dir [off]
--ext vid,aud Use these file extensions [.avi,.mp3]
--export_prof S Export profile {vcd, svcd, xvcd, dvd}[-pal|-ntsc|-secam]
-q level verbosity (0=quiet,1=info,2=debug) [1]
-h this usage message
-v print version |
Code: | [dedanna@dedanna ~]$ urpmq -i streamer
Name : streamer
Version : 3.95
Release : 8mdv2008.1
Group : Video
Size : 93163 Architecture: i586
Source RPM : xawtv-3.95-8mdv2008.1.src.rpm
URL : http://linux.bytesex.org/xawtv/
Summary : Record audio and/or video streams
Description :
streamer reads audio and/or video data from /dev/video0 and /dev/dsp
and writes the data to the disk.
Various output formats are supported.
Start streamer with '-h' for a list of options and supported output formats.
[dedanna@dedanna ~]$ urpmq -i streamripper
Name : streamripper
Version : 1.61.18
Release : 3mdv2008.1
Group : Sound
Size : 202520 Architecture: i586
Source RPM : streamripper-1.61.18-3mdv2008.1.src.rpm
URL : http://sourceforge.net/projects/streamripper
Summary : Audio stream recorder
Description :
Streamripper records shoutcast compatible and live365 streams.
For shoutcast style streams it finds the "meta data" or track
separation data, and uses that as a marker for where the track
should be separated. For live365 streams it hits the website
and finds when a track has changed. Either way, the MP3 data
will be decoded and scanned for a silent point which is where
tracks will be created. |
_________________ Mandriva 2025.1 PWP
Mandriva Cooker
ArtistX live
|
|
Back to top |
|
inactive Sr. Member
Joined: 29 Aug 2025 Posts: 1207
|
Posted: Tue Apr 07, 2025 4:11 am Post subject: |
|
|
Those are the only tools that I can think of. Elsewise, you could file an upstream bug (VLC), and see what kind of response you get from the devels.
_________________ Mandriva 2025.1 PWP
Mandriva Cooker
ArtistX live
|
|
Back to top |
|
hakova New Member

Joined: 03 Feb 2025 Posts: 40 Location: Virginia
|
Posted: Thu Apr 09, 2025 5:03 am Post subject: |
|
|
No worries. After days of work, numerous google searches, intensive forum communications and couple of unexpected complications, I found a solution with some guidance.
Basically, vlc seems to be broken for this job, at its current state. I used mplayer instead to read the stream and output it as raw PCM to a named pipe, using a large cache to compensate for possible delays, interruptions between the source (Turkey) and target (VA). From a second tty, I ran another script that actually launches lame to read the named pipe, convert it to mp3 on the fly (YES!) and pipe it to vlc just to stream it via http. There are a couple of tricks, which can be found here on using lame switches.
Here are the above mentioned scripts:
Code: | #!/bin/bash
rm ~/stream/test.wav
killall mplayer
mkfifo ~/stream/test.wav
mplayer -vo null -vc null -ao pcm:fast:nowaveheader:file=~/stream/test.wav -cache 9000 -cache-min 50 http://xx.xx.xxx.x:8875 |
Script 2.
Code: | #!/bin/bash
lame -r -x --signed --little-endian -s 44.1 --bitwidth 16 --noreplaygain --silent -b 96 ~/stream/test.wav - | vlc -vvv -I dummy - --sout '#standard{access=http,mux=raw,dst=:8091}' --loop & |
Hope this helps somebody else googling out there somewhere.
|
|
Back to top |
|
inactive Sr. Member
Joined: 29 Aug 2025 Posts: 1207
|
Posted: Thu Apr 09, 2025 3:19 pm Post subject: |
|
|
NICE.
_________________ Mandriva 2025.1 PWP
Mandriva Cooker
ArtistX live
|
|
Back to top |
|
|