Convert pcm to ulaw

About encoding, codec settings, muxers and filter usage
IMS77
Blank Cone
Blank Cone
Posts: 13
Joined: 06 Jul 2011 16:38
Location: France

Convert pcm to ulaw

Postby IMS77 » 06 Jul 2011 17:12

Hi,

I'm trying to transcode a file in pcm format (wav container) to ulaw format (also wav container), is it possible ?
I'm using vlc 1.1.4.

Code: Select all

int testConvertPcmToUlaw(libvlc_instance_t *vlc_instance) { char input_audio[] = "file:///tmp/pcm.wav"; // char output_audio[] = "/tmp/test.mp3"; char output_audio[] = "/tmp/result.wav"; libvlc_media_player_t *mp; libvlc_media_t *media; /* Create a new item */ media = libvlc_media_new_path(vlc_instance, input_audio); char options[256] = ""; //sprintf(options, ":sout=#transcode{acodec=mp3,ab=64,channels=1,samplerate=8000}:file{dst='%s'}", output_audio); sprintf(options, ":sout=#transcode{acodec=ulaw,ab=32,channels=1,samplerate=8000}:file{dst='%s'}", output_audio); libvlc_media_add_option(media, options); /* Create a media player playing environment */ mp = libvlc_media_player_new_from_media(media); /* No need to keep the media now */ libvlc_media_release(media); /* Attach event to the media player */ libvlc_event_manager_t *eventManager = libvlc_media_player_event_manager(mp); libvlc_event_attach(eventManager, libvlc_MediaPlayerEndReached, (libvlc_callback_t)trapEndReachedEvent, NULL); libvlc_event_attach(eventManager, libvlc_MediaPlayerEncounteredError, (libvlc_callback_t)trapEndReachedEvent, NULL); /* play the media_player */ libvlc_media_player_play(mp); bContinue = 1; while(bContinue) { sleep(1); /* Let it play a bit */ } /* Stop playing */ libvlc_media_player_stop(mp); /* Free the media_player */ libvlc_media_player_release(mp); return 0; }
The same code to transcode my pcm file to mp3 works well. What is the problem ?
Here the ouput debug

Code: Select all

[0x9e650bc] main libvlc debug: VLC media player - 1.1.4 The Luggage [0x9e650bc] main libvlc debug: Copyright © 1996-2010 the VideoLAN team [0x9e650bc] main libvlc debug: revision exported [0x9e650bc] main libvlc debug: configured with ./configure '--enable-static' '--build=i686-linux-gnu' '--config-cache' '--disable-maintainer-mode' '--disable-silent-rules' '--disable-update-check' '--enable-fast-install' '--prefix=/usr' '--sysconfdir=/etc' '--with-binary-version=1ubuntu1.6' '--enable-a52' '--enable-aa' '--enable-bonjour' '--enable-caca' '--enable-dca' '--enable-dirac' '--enable-dvb' '--enable-dvbpsi' '--enable-dvdnav' '--enable-faad' '--enable-flac' '--enable-fluidsynth' '--enable-freetype' '--enable-fribidi' '--enable-ggi' '--enable-gnutls' '--enable-jack' '--enable-kate' '--enable-libass' '--enable-libmpeg2' '--enable-libproxy' '--enable-libxml2' '--enable-lirc' '--enable-live555' '--enable-mad' '--enable-mkv' '--enable-mod' '--enable-mozilla' '--enable-mpc' '--enable-mtp' '--enable-mux_ogg' '--enable-ncurses' '--enable-notify' '--enable-ogg' '--enable-pulse' '--enable-qt4' '--enable-realrtsp' '--enable-schroedinger' '--enable-sdl' '--enable-shout' '--enable-skins2' '--enable-smb' '--enable-speex' '--enable-svg' '--enable-taglib' '--enable-theora' '--enable-twolame' '--enable-upnp' '--enable-vcd' '--enable-vcdx' '--enable-vorbis' '--enable-x264' '--enable-zvbi' '--with-kde-solid=/usr/share/kde4/apps/' '--with-mozilla-pkg=libxul' '--disable-dxva2' '--disable-gnomevfs' '--disable-goom' '--disable-osso_screensaver' '--disable-portaudio' '--disable-projectm' '--disable-sqlite' '--disable-telx' '--enable-alsa' '--enable-atmo' '--enable-dc1394' '--enable-dv' '--enable-libva' '--enable-pvr' '--enable-udev' '--enable-v4l' '--enable-v4l2' '--enable-svgalib' 'build_alias=i686-linux-gnu' 'CFLAGS=-g -O2' 'LDFLAGS=-Wl,--as-needed' 'CPPFLAGS=' 'CXXFLAGS=-g -O2' [0x9e650bc] main libvlc debug: translation test: code is "C" [0x9e650bc] main libvlc debug: checking plugin modules [0x9e650bc] main libvlc debug: loading plugins cache file /usr/lib/vlc/plugins/plugins-04041e-3e8.dat [0x9e650bc] main libvlc debug: recursively browsing `/usr/lib/vlc/plugins' [0x9e650bc] main libvlc debug: saving plugins cache /usr/lib/vlc/plugins/plugins-04041e-3e8.dat [0x9e650bc] main libvlc debug: module bank initialized (394 modules) [0x9e650bc] main libvlc debug: CPU has capabilities MMX MMXEXT SSE SSE2 SSE3 SSSE3 FPU [0x9e650bc] main libvlc debug: looking for memcpy module: 3 candidates [0x9e650bc] main libvlc debug: using memcpy module "memcpymmxext" [0x9f14364] main input debug: Creating an input for 'Media Library' [0x9f14364] main input debug: Input is a meta file: disabling unneeded options [0x9f14364] main input debug: using timeshift granularity of 50 MiB [0x9f14364] main input debug: using timeshift path '/tmp' [0x9f14364] main input debug: `file/xspf-open:///home/millereux/.local/share/vlc/ml.xspf' gives access `file' demux `xspf-open' path `/home/millereux/.local/share/vlc/ml.xspf' [0x9f14364] main input debug: creating demux: access='file' demux='xspf-open' path='/home/millereux/.local/share/vlc/ml.xspf' [0x9f12cc4] main demux debug: looking for access_demux module: 2 candidates [0x9f12cc4] main demux debug: no access_demux module matching "file" could be loaded [0x9f12cc4] main demux debug: TIMER module_need() : 1.419 ms - Total 1.419 ms / 1 intvls (Avg 1.419 ms) [0x9f14364] main input debug: creating access 'file' path='/home/millereux/.local/share/vlc/ml.xspf' [0x9efda14] main access debug: looking for access module: 2 candidates [0x9efda14] filesystem access debug: opening file `/home/millereux/.local/share/vlc/ml.xspf' [0x9efda14] main access debug: using access module "filesystem" [0x9efda14] main access debug: TIMER module_need() : 0.951 ms - Total 0.951 ms / 1 intvls (Avg 0.951 ms) [0x9ef860c] main stream debug: Using AStream*Stream [0x9ef860c] main stream debug: pre buffering [0x9ef860c] main stream debug: received first data after 0 ms [0x9ef860c] main stream debug: pre-buffering done 296 bytes in 0s - 2240 KiB/s [0x9efd7d4] main stream debug: looking for stream_filter module: 5 candidates [0x9efd7d4] main stream debug: no stream_filter module matching "any" could be loaded [0x9efd7d4] main stream debug: TIMER module_need() : 6.427 ms - Total 6.427 ms / 1 intvls (Avg 6.427 ms) [0x9efd7d4] main stream debug: looking for stream_filter module: 1 candidate [0x9efd7d4] main stream debug: using stream_filter module "stream_filter_record" [0x9efd7d4] main stream debug: TIMER module_need() : 0.756 ms - Total 0.756 ms / 1 intvls (Avg 0.756 ms) [0x9f14364] main input debug: creating demux: access='file' demux='xspf-open' path='/home/millereux/.local/share/vlc/ml.xspf' [0x9efcc6c] main demux debug: looking for demux module: 1 candidate [0x9efcc6c] playlist demux debug: using XSPF playlist reader [0x9efcc6c] main demux debug: using demux module "playlist" [0x9efcc6c] main demux debug: TIMER module_need() : 0.976 ms - Total 0.976 ms / 1 intvls (Avg 0.976 ms) [0x9efa384] main demux meta debug: looking for meta reader module: 2 candidates [0x9efa384] lua demux meta debug: Trying Lua scripts in /home/millereux/.local/share/vlc/lua/meta/reader [0x9efa384] lua demux meta debug: Trying Lua scripts in /usr/lib/vlc/lua/meta/reader [0x9efa384] lua demux meta debug: Trying Lua playlist script /usr/lib/vlc/lua/meta/reader/filename.luac [0x9efa384] lua demux meta debug: Trying Lua scripts in /usr/share/vlc/lua/meta/reader [0x9efa384] main demux meta debug: no meta reader module matching "any" could be loaded [0x9efa384] main demux meta debug: TIMER module_need() : 10.789 ms - Total 10.789 ms / 1 intvls (Avg 10.789 ms) [0x9f14364] main input debug: `file/xspf-open:///home/millereux/.local/share/vlc/ml.xspf' successfully opened [0x9efa384] main xml debug: looking for xml module: 2 candidates [0x9efa384] main xml debug: using xml module "xml" [0x9efa384] main xml debug: TIMER module_need() : 0.810 ms - Total 0.810 ms / 1 intvls (Avg 0.810 ms) [0x9efcc6c] playlist demux debug: parsed 0 tracks successfully [0x9efa384] main xml debug: removing module "xml" [0x9f14364] main input debug: EOF reached [0x9efcc6c] main demux debug: removing module "playlist" [0x9efd7d4] main stream debug: removing module "stream_filter_record" [0x9efda14] main access debug: removing module "filesystem" [0x9f14364] main input debug: TIMER input launching for 'Media Library' : 24.459 ms - Total 24.459 ms / 1 intvls (Avg 24.459 ms) [0x9efa384] main interface debug: looking for interface module: 1 candidate [0x9efa384] logger interface: using logger. [0x9efa384] logger interface warning: no log filename provided, using `vlc-log.txt' [0x9efa384] logger interface debug: opening logfile `vlc-log.txt' [0x9efa384] main interface debug: using interface module "logger" [0x9efa384] main interface debug: TIMER module_need() : 1.090 ms - Total 1.090 ms / 1 intvls (Avg 1.090 ms) [0x9ef8dc4] main interface debug: looking for interface module: 1 candidate [0x9ef8dc4] main interface debug: using interface module "hotkeys" [0x9ef8dc4] main interface debug: TIMER module_need() : 0.837 ms - Total 0.837 ms / 1 intvls (Avg 0.837 ms) [0x9efcc6c] main interface debug: looking for interface module: 1 candidate [0x9e73654] main playlist debug: Activated [0x9efcc6c] main interface debug: using interface module "inhibit" [0x9efcc6c] main interface debug: TIMER module_need() : 4.631 ms - Total 4.631 ms / 1 intvls (Avg 4.631 ms) [0x9f0be54] main input debug: Creating an input for 'pcm.wav' [0x9f0be54] main input debug: thread (input) created at priority 10 (input/input.c:214) [0x9e73654] main playlist debug: rebuilding array of current - root Playlist [0x9e73654] main playlist debug: rebuild done - 0 items, index -1 [0x9f0be54] main input debug: thread started [0x9f0f9d4] main stream output debug: using sout chain=`transcode{vcodec=none,acodec=ulaw,ab=32,channels=1,samplerate=8000,deinterlace}:file{dst='/tmp/result.wav'}' [0x9f0f9d4] main stream output debug: stream=`file' [0x9f159a4] main stream out debug: looking for sout stream module: 1 candidate [0x9f159a4] main stream out debug: set config option: sout-standard-dst to /tmp/result.wav [0x9f159a4] stream_out_standard stream out debug: creating `file/(null):///tmp/result.wav' [0x9f159a4] stream_out_standard stream out debug: extension is wav [0x9f159a4] stream_out_standard stream out debug: extension -> mux=wav [0x9f159a4] stream_out_standard stream out debug: using `file/wav:///tmp/result.wav' [0x9f16fc4] main access out debug: looking for sout access module: 1 candidate [0x9f16fc4] access_output_file access out debug: file access output opened (/tmp/result.wav) [0x9f16fc4] main access out debug: using sout access module "access_output_file" [0x9f16fc4] main access out debug: TIMER module_need() : 1.131 ms - Total 1.131 ms / 1 intvls (Avg 1.131 ms) [0x9f159a4] stream_out_standard stream out debug: access opened [0x9f17c5c] main mux debug: looking for sout mux module: 1 candidate [0x9f17c5c] main mux debug: using sout mux module "mux_wav" [0x9f17c5c] main mux debug: TIMER module_need() : 0.669 ms - Total 0.669 ms / 1 intvls (Avg 0.669 ms) [0x9f159a4] stream_out_standard stream out debug: mux opened [0x9f159a4] main stream out debug: using sout stream module "stream_out_standard" [0x9f159a4] main stream out debug: TIMER module_need() : 4.008 ms - Total 4.008 ms / 1 intvls (Avg 4.008 ms) [0x9f0f9d4] main stream output debug: stream=`transcode' [0x9f1621c] main stream out debug: looking for sout stream module: 1 candidate [0x9f1621c] main stream out debug: set config option: sout-transcode-vcodec to none [0x9f1621c] main stream out debug: set config option: sout-transcode-acodec to ulaw [0x9f1621c] main stream out debug: set config option: sout-transcode-ab to 32 [0x9f1621c] main stream out debug: set config option: sout-transcode-channels to 1 [0x9f1621c] main stream out debug: set config option: sout-transcode-samplerate to 8000 [0x9f1621c] main stream out debug: set config option: sout-transcode-deinterlace to (null) [0x9f1621c] stream_out_transcode stream out debug: codec audio=ulaw 8000Hz 1 channels 32Kb/s [0x9f1621c] stream_out_transcode stream out debug: codec video=none 0x0 scaling: 0.000000 0kb/s [0x9f1621c] main stream out debug: using sout stream module "stream_out_transcode" [0x9f1621c] main stream out debug: TIMER module_need() : 1.899 ms - Total 1.899 ms / 1 intvls (Avg 1.899 ms) [0x9f0be54] main input debug: using timeshift granularity of 50 MiB [0x9f0be54] main input debug: using timeshift path '/tmp' [0x9f0be54] main input debug: `file:///tmp/pcm.wav' gives access `file' demux `' path `/tmp/pcm.wav' [0x9f0be54] main input debug: creating demux: access='file' demux='' path='/tmp/pcm.wav' [0x9f186bc] main demux debug: looking for access_demux module: 2 candidates [0x9f186bc] main demux debug: no access_demux module matching "file" could be loaded [0x9f186bc] main demux debug: TIMER module_need() : 0.556 ms - Total 0.556 ms / 1 intvls (Avg 0.556 ms) [0x9f0be54] main input debug: creating access 'file' path='/tmp/pcm.wav' [0x9f186bc] main access debug: looking for access module: 2 candidates [0x9f186bc] filesystem access debug: opening file `/tmp/pcm.wav' [0x9f186bc] main access debug: using access module "filesystem" [0x9f186bc] main access debug: TIMER module_need() : 0.684 ms - Total 0.684 ms / 1 intvls (Avg 0.684 ms) [0x9f18984] main stream debug: Using AStream*Stream [0x9f18984] main stream debug: pre buffering [0x9f18984] main stream debug: received first data after 0 ms [0x9f18984] main stream debug: pre-buffering done 1024 bytes in 0s - 6451 KiB/s [0x9f18b94] main stream debug: looking for stream_filter module: 5 candidates [0x9f18b94] main stream debug: no stream_filter module matching "any" could be loaded [0x9f18b94] main stream debug: TIMER module_need() : 0.365 ms - Total 0.365 ms / 1 intvls (Avg 0.365 ms) [0x9f18b94] main stream debug: looking for stream_filter module: 1 candidate [0x9f18b94] main stream debug: using stream_filter module "stream_filter_record" [0x9f18b94] main stream debug: TIMER module_need() : 0.333 ms - Total 0.333 ms / 1 intvls (Avg 0.333 ms) [0x9f0be54] main input debug: creating demux: access='file' demux='' path='/tmp/pcm.wav' [0x9f18d24] main demux debug: looking for demux module: 52 candidates [0x9f18d24] wav demux debug: chunk: fcc=`fmt ` size=16 [0x9f18d24] wav demux debug: format: 0x0001, fourcc: araw, channels: 1, freq: 8000 Hz, bitrate: 15Ko/s, blockalign: 2, bits/samples: 16, extra size: 0 [0x9f18d24] wav demux debug: found Raw audio audio format [0x9f18d24] wav demux debug: chunk: fcc=`data` size=183040 [0x9f0be54] main input debug: selecting program id=0 [0x9f18d24] main demux debug: using demux module "wav" [0x9f18d24] main demux debug: TIMER module_need() : 3.331 ms - Total 3.331 ms / 1 intvls (Avg 3.331 ms) [0x9f0be54] main input debug: looking for a subtitle file in /tmp/ [0x9f1a40c] main decoder debug: looking for packetizer module: 21 candidates [0x9f1a40c] main decoder debug: using packetizer module "packetizer_copy" [0x9f1a40c] main decoder debug: TIMER module_need() : 4.494 ms - Total 4.494 ms / 1 intvls (Avg 4.494 ms) [0x9f1a40c] main decoder debug: thread (decoder) created at priority 5 (input/decoder.c:301) [0x9f1a40c] main decoder debug: thread started [0x9f0be54] main input debug: starting in sync mode [0x9f1db2c] main demux meta debug: looking for meta reader module: 2 candidates [0x9f1db2c] lua demux meta debug: Trying Lua scripts in /home/millereux/.local/share/vlc/lua/meta/reader [0x9f1db2c] lua demux meta debug: Trying Lua scripts in /usr/lib/vlc/lua/meta/reader [0x9f1db2c] lua demux meta debug: Trying Lua playlist script /usr/lib/vlc/lua/meta/reader/filename.luac [0x9f1db2c] lua demux meta debug: Trying Lua scripts in /usr/share/vlc/lua/meta/reader [0x9f1db2c] main demux meta debug: no meta reader module matching "any" could be loaded [0x9f1db2c] main demux meta debug: TIMER module_need() : 0.976 ms - Total 0.976 ms / 1 intvls (Avg 0.976 ms) [0x9f0be54] main input debug: `file:///tmp/pcm.wav' successfully opened [0x9f0be54] main input debug: Buffering 0% [0x9f0be54] main input debug: switching to async mode [0x9f0be54] main input debug: Buffering 16% [0x9f0be54] main input debug: Buffering 33% [0x9f0be54] main input debug: Buffering 50% [0x9f0be54] main input debug: Buffering 66% [0x9f0be54] main input debug: Buffering 83% [0x9f0be54] main input debug: Buffering 100% [0x9f0be54] main input debug: Stream buffering done (350 ms in 0 ms) [0x9f0f9d4] main stream output debug: adding a new sout input (sout_input:0x9f1c9e0) [0x9f1621c] stream_out_transcode stream out debug: creating audio transcoding from fcc=`s16l' to fcc=`ulaw' [0x9f26e04] main generic debug: looking for decoder module: 30 candidates [0x9f26e04] araw generic debug: samplerate:8000Hz channels:1 bits/sample:16 [0x9f26e04] main generic debug: using decoder module "araw" [0x9f26e04] main generic debug: TIMER module_need() : 4.268 ms - Total 4.268 ms / 1 intvls (Avg 4.268 ms) [0x9f23a0c] main encoder debug: looking for encoder module: 11 candidates [0x9f23a0c] avcodec encoder debug: libavcodec initialized (interface 0x344802) [0x9f23a0c] avcodec encoder debug: found encoder PCM MU-LAW [0x9f23a0c] main encoder debug: using encoder module "avcodec" [0x9f23a0c] main encoder debug: TIMER module_need() : 16.246 ms - Total 16.246 ms / 1 intvls (Avg 16.246 ms) [0x9f17c5c] main mux debug: adding a new input [0x9f17c5c] mux_wav mux debug: adding 1 input channels, 8000Hz [0x9f0be54] main input debug: Decoder buffering done in 21 ms [0x9f17c5c] mux_wav mux debug: writing header data [0x9f0be54] main input debug: EOF reached [0x9f0be54] main input debug: waiting decoder fifos to empty [0x9f1a40c] main decoder debug: removing module "packetizer_copy" [0x9f1a40c] main decoder debug: killing decoder fourcc `s16l', 0 PES in FIFO [0x9f0f9d4] main stream output debug: removing a sout input (sout_input:0x9f1c9e0) [0x9f23a0c] main encoder debug: TIMER encoding audio frame : 0.000 ms - Total 0.561 ms / 228 intvls (Avg 0.002 ms) [0x9f26e04] main generic debug: removing module "araw" [0x9f23a0c] main encoder debug: removing module "avcodec" [0x9f17c5c] mux_wav mux debug: removing input [0x9f17c5c] mux_wav mux debug: writing header data [0x9f17c5c] main mux warning: no more input streams for this mux [0x9f18d24] main demux debug: removing module "wav" [0x9f18b94] main stream debug: removing module "stream_filter_record" [0x9f186bc] main access debug: removing module "filesystem" [0x9f0be54] main input debug: Program doesn't contain anymore ES [0x9f0be54] main input debug: thread ended [0x9f0be54] main input debug: TIMER input launching for 'pcm.wav' : 21.854 ms - Total 21.854 ms / 1 intvls (Avg 21.854 ms) [0x9f1621c] main stream out debug: destroying chain... (name=transcode) [0x9f1621c] main stream out debug: removing module "stream_out_transcode" [0x9f1621c] main stream out debug: destroying chain done [0x9f159a4] main stream out debug: destroying chain... (name=file) [0x9f17c5c] main mux debug: removing module "mux_wav" [0x9f16fc4] access_output_file access out debug: file access output closed [0x9f16fc4] main access out debug: removing module "access_output_file" [0x9f159a4] main stream out debug: removing module "stream_out_standard" [0x9f159a4] main stream out debug: destroying chain done [0x9e650bc] main libvlc debug: deactivating the playlist [0x9e73654] main playlist debug: Deactivate [0x9f12324] main playlist export debug: saving Media Library to file /home/millereux/.local/share/vlc/ml.xspf [0x9f12324] main playlist export debug: looking for playlist export module: 1 candidate [0x9f12324] main playlist export debug: using playlist export module "export" [0x9f12324] main playlist export debug: TIMER module_need() : 0.610 ms - Total 0.610 ms / 1 intvls (Avg 0.610 ms) [0x9f12324] main playlist export debug: removing module "export" [0x9e73654] main playlist debug: Deactivated [0x9e650bc] main libvlc debug: removing all services discovery tasks [0x9e650bc] main libvlc debug: removing all interfaces [0x9efcc6c] main interface debug: removing module "inhibit" [0x9ef8dc4] main interface debug: removing module "hotkeys" [0x9efa384] main interface debug: removing module "logger" [0x9e73654] main playlist debug: destroying [0x9e650bc] main libvlc debug: TIMER ML Load : Total 27.052 ms / 1 intvls (Avg 27.052 ms) [0x9e650bc] main libvlc debug: TIMER Items array build : Total 0.335 ms / 1 intvls (Avg 0.335 ms) [0x9e650bc] main libvlc debug: TIMER ML Dump : Total 0.889 ms / 1 intvls (Avg 0.889 ms) [0x9e650bc] main libvlc debug: removing stats [0x9e650bc] main libvlc debug: removing module "memcpymmxext"
Thanks for any help !

Sebastien

Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 22 guests