Transcoding from MPEG4/AAC to Theora/Vorbis

About encoding, codec settings, muxers and filter usage
ph0t0n
Blank Cone
Blank Cone
Posts: 81
Joined: 02 Apr 2008 22:36
VLC version: 0.8.6f
Operating System: Mac OS X 10.4.11
Location: Norway

Transcoding from MPEG4/AAC to Theora/Vorbis

Postby ph0t0n » 09 Apr 2008 00:51

Hi, all!

I have experimented with VLC for quite some time now, trying to transcode MPEG4/AAC to Theora/Vorbis for my final school project.
Initially, h264 was chosen, but abandoned because RTSP discards DST values needed by VLC for processing.

Reading from an .mp4 file and writing to an .ogg file DOES work, using:

/Applications/VLC.app/Contents/MacOS/VLC -vvvv Movies/lab.mp4 --codec faad --sout \ "#transcode{vcodec=theora,vb=1000,venc=theora,acodec=vorbis,ab=64,aenc=vorbis} \ :standard{access=file,mux=ogg,dst=Movies/lab.ogg}"

However, I am trying to transcode live streams, NOT files.

The scenario:

I want to use VLC to pick up an RTSP-stream containing MPEG4/AAC from Darwin Streaming Server (sent to it from Wirecast3),
transcode it to Theora/Vorbis and send to an Icecast2 server over HTTP. To achieve this, I run the following:

/Applications/VLC.app/Contents/MacOS/VLC -vvvv rtsp://darwinserver:554/lab.sdp --access live555 --rtsp-caching 2000 --codec faad \
--sout "#transcode{vcodec=theora,vb=1000,venc=theora,acodec=vorbis,ab=64,aenc=vorbis} \ :standard{access=shout,mux=ogg,dst=user:pass@icecastserver:8888/lab.ogg}"

I can see the mount point in Icecast2 admin UI, but VLC dies after a few seconds with a '5173 Segmentation Fault' error message.
OS X also produces a problem report that includes (among lots of information):

Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_INVALID_ADDRESS (0x0001) at 0x66377be9

I am using Mac OS X 10.4.11, VLC v0.8.6f, DSS 5.5.5, and Icecast2 2.3.1-1 from Fink.
I have tried to use ffmpeg2theora for transcoding, but cannot get it to decode AAC / encode Vorbis.

Any ideas? Help is most definitely appreciated! :-)

* * * * *

UPDATE 11.04: Requesting the URL rtsp://darwinserver:554/lab.mp4 (using the file name and extension of the actual playlist item - a file, not a remotely announced mount point) instead of rtsp://darwinserver:554/lab.sdp (the name of the playlist itself), and saving to disk instead of streaming on to Icecast, I get both video and audio, without VLC crashing. However, leaving the extension as .sdp cancels audio output when playing the video.

1) mplayer reports audio is present in the resulting .mp4 file in BOTH cases (which I assume means the chosen AAC decoder is correct)
2) audio and video tracks switch from occupying #0 and #1 respectively, using .mp4 - to tracks #1 and #0 using .sdp

Is it possible to force audio to use track #0?

I cannot see that from reading the 3500++ line long 'vlc --advanced --longhelp --help-verbose' textfile I made ...

Btw: renaming the announce job for the source feed from Wirecast to .mp4 fails (it is silently ignored). So much for an easy fix!
Last edited by ph0t0n on 11 Apr 2008 00:59, edited 1 time in total.

johansyd
Blank Cone
Blank Cone
Posts: 25
Joined: 27 Feb 2008 11:10

Re: Transcoding from MPEG4/AAC to Theora/Vorbis

Postby johansyd » 10 Apr 2008 02:20

Streaming theora:

./vlc -vvv rtsp://158.39.162.136/my_stream.sdp --sout '#transcode{venc=theora,aenc=vorbis, vb=1024,ab=64}:duplicate{dst=std{access=shout{ogg=1,protocol=icy},mux=mux_ogg,dst=source:password@localhost:8000/test.ogg}}'

./vlc -vvv rtsp://158.39.162.136/my_stream.sdp --sout '#transcode{venc=theora,aenc=vorbis, vb=1024,ab=64}:std{access=shout{ogg=1,protocol=icy},mux=mux_ogg,dst=source:password@localhost:8000/test.ogg}'

On this one I can get a picture, but no transcoding:

./vlc -vvv rtsp://158.39.162.136/my_stream.sdp :sout=#transcode{venc=theora,aenc=vorbis, vb=1024,ab=64}:duplicate{dst=std{access=shout{ogg=1,protocol=icy},mux=mux_ogg,dst=source:password@localhost:8000/test.ogg}}

output:

Code: Select all

VLC media player 0.8.6f Janus [00000001] main private debug: checking builtin modules [00000001] main private debug: checking plugin modules [00000001] main private debug: loading plugins cache file /home/johansyd/.vlc/cache/plugins-04081e.dat [00000001] main private debug: recursively browsing `modules' [00000001] main private debug: recursively browsing `/usr/local/lib/vlc' [00000001] main private debug: recursively browsing `plugins' [00000001] main private debug: module bank initialized, found 426 modules [00000001] main private debug: opening config file /home/johansyd/.vlc/vlcrc [00000001] main private debug: CPU has capabilities 486 586 MMX MMXEXT SSE SSE2 FPU [00000001] main private debug: looking for memcpy module: 4 candidates [00000001] main private debug: using memcpy module "memcpymmxext" [00000548] main playlist debug: waiting for thread completion [00000548] main playlist debug: thread 1082132816 (playlist) created at priority 0 (playlist/playlist.c:184) [00000549] main private debug: waiting for thread completion [00000549] main private debug: thread 1090525520 (preparser) created at priority 0 (playlist/playlist.c:210) [00000550] main interface debug: looking for interface module: 2 candidates [00000550] main interface debug: using interface module "hotkeys" [00000550] main interface debug: thread 1098918224 (interface) created at priority 0 (interface/interface.c:231) [00000552] main interface debug: looking for interface module: 2 candidates [00000552] main interface debug: using interface module "screensaver" [00000552] main interface debug: thread 1107310928 (interface) created at priority 0 (interface/interface.c:231) [00000554] main interface debug: looking for interface module: 2 candidates [00000554] main interface debug: using interface module "showintf" [00000554] main interface debug: thread 1115703632 (interface) created at priority 0 (interface/interface.c:231) [00000548] main playlist debug: adding playlist item `rtsp://158.39.162.136/my_stream.sdp' ( rtsp://158.39.162.136/my_stream.sdp ) [00000556] main interface debug: looking for interface module: 8 candidates [00000556] main interface debug: using interface module "wxwidgets" [00000556] main interface debug: thread 1124096336 (manager) created at priority 0 (interface/interface.c:216) [00000556] wxwidgets interface debug: Using last windows config '(-1,0,0,1280,1024)(0,795,44,425,328)(2,0,25,410,564)(6,0,0,-1,150)' [00000556] wxwidgets interface debug: id=0 p=(795,44) s=(425,328) [00000556] wxwidgets interface debug: id=2 p=(0,25) s=(410,564) [00000556] wxwidgets interface debug: id=6 p=(0,0) s=(-1,150) [00000548] main playlist debug: nothing requested, starting [00000548] main playlist debug: creating new input thread [00000559] main input debug: waiting for thread completion [00000559] main input debug: creating statistics handler [00000561] main stream output debug: stream=`transcode' [00000562] main private debug: looking for sout stream module: 2 candidates [00000561] main stream output debug: stream=`std' [00000565] main private debug: looking for sout stream module: 2 candidates [00000565] main private debug: set sout option: sout-standard-access to shout{ogg=1,protocol=icy} [00000565] main private debug: set sout option: sout-standard-mux to mux_ogg [00000565] main private debug: set sout option: sout-standard-dst to source:sexy4you@localhost:8000/test.ogg [00000565] stream_out_standard private debug: creating `shout{ogg=1,protocol=icy}/mux_ogg://source:sexy4you@localhost:8000/test.ogg' [00000565] stream_out_standard private debug: extension is ogg [00000565] stream_out_standard private debug: extension -> mux=ogg [00000565] stream_out_standard private debug: using `shout{ogg=1,protocol=icy}/mux_ogg://source:sexy4you@localhost:8000/test.ogg' [00000567] main private debug: looking for sout access module: 1 candidate [00000567] main private warning: option ogg is unknown [00000567] main private warning: option protocol is unknown [00000567] access_output_shout private warning: failed to connect using 'icy' (shoutcast) protocol [00000559] main input debug: thread 1132489040 (input) created at priority 0 (input/input.c:265) [00000567] access_output_shout private debug: connected using 'http' (icecast 2.x) protocol [00000567] access_output_shout private debug: shout access output opened (source@localhost:8000/test.ogg) [00000567] main private debug: using sout access module "access_output_shout" [00000565] stream_out_standard private debug: access opened [00000569] main private debug: looking for sout mux module: 2 candidates [00000569] mux_ogg private: Open [00000569] main private debug: using sout mux module "mux_ogg" [00000561] main stream output debug: muxer support adding stream at any time [00000561] main stream output debug: muxer prefers to wait for all ES before starting to mux [00000565] stream_out_standard private debug: mux opened [00000565] main private debug: using sout stream module "stream_out_standard" [00000562] main private debug: set sout option: sout-transcode-venc to theora [00000562] main private debug: set sout option: sout-transcode-aenc to vorbis [00000562] main private debug: set sout option: sout-transcode-vb to 1024 [00000562] main private debug: set sout option: sout-transcode-ab to 64 [00000562] main private debug: using sout stream module "stream_out_transcode" [00000559] main input debug: `rtsp://158.39.162.136/my_stream.sdp' gives access `rtsp' demux `' path `158.39.162.136/my_stream.sdp' [00000559] main input debug: creating demux: access='rtsp' demux='' path='158.39.162.136/my_stream.sdp' [00000571] main demuxer debug: looking for access_demux module: 2 candidates Sending request: OPTIONS rtsp://158.39.162.136/my_stream.sdp RTSP/1.0 CSeq: 1 User-Agent: VLC media player (LIVE555 Streaming Media v2007.02.20) Received OPTIONS response: RTSP/1.0 200 OK Server: QTSS/5.5.3 (Build/489.0.4; Platform/MacOSX; Release/Update; ) Cseq: 1 Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, OPTIONS, ANNOUNCE, RECORD Sending request: DESCRIBE rtsp://158.39.162.136/my_stream.sdp RTSP/1.0 CSeq: 2 Accept: application/sdp User-Agent: VLC media player (LIVE555 Streaming Media v2007.02.20) Received DESCRIBE response: RTSP/1.0 200 OK Server: QTSS/5.5.3 (Build/489.0.4; Platform/MacOSX; Release/Update; ) Cseq: 2 Cache-Control: no-cache Content-length: 527 Date: Thu, 10 Apr 2008 00:12:57 GMT Expires: Thu, 10 Apr 2008 00:12:57 GMT Content-Type: application/sdp x-Accept-Retransmit: our-retransmit x-Accept-Dynamic-Rate: 1 Content-Base: rtsp://158.39.162.136/my_stream.sdp/ Need to read 527 extra bytes Read 527 extra bytes: v=0 o=- 367772162 367772162 IN IP4 127.0.0.0 s=Wirecast c=IN IP4 0.0.0.0 t=0 0 a=range:npt=now- a=control:* m=audio 0 RTP/AVP 96 a=rtpmap:96 mpeg4-generic/44100/2 a=fmtp:96 profile-level-id=15;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1210 a=control:trackid=1 m=video 0 RTP/AVP 97 a=rtpmap:97 MP4V-ES/90000 a=fmtp:97 profile-level-id=1;config=000001B0F3000001B50EE040C0CF0000010000000120008440FA285020F0A31F a=cliprect:0,0,240,320 a=framesize:97 320-240 b=AS:1372 a=control:trackid=2 [00000571] live555 demuxer debug: RTP subsession 'audio/MPEG4-GENERIC' Sending request: SETUP rtsp://158.39.162.136/my_stream.sdp/trackid=1 RTSP/1.0 CSeq: 3 Transport: RTP/AVP;unicast;client_port=32822-32823 User-Agent: VLC media player (LIVE555 Streaming Media v2007.02.20) Received SETUP response: RTSP/1.0 200 OK Server: QTSS/5.5.3 (Build/489.0.4; Platform/MacOSX; Release/Update; ) Cseq: 3 Cache-Control: no-cache Session: 3555079508826329464 Date: Thu, 10 Apr 2008 00:12:57 GMT Expires: Thu, 10 Apr 2008 00:12:57 GMT Transport: RTP/AVP;unicast;source=158.39.162.136;client_port=32822-32823;server_port=6976-6977 [00000571] live555 demuxer debug: RTP subsession 'video/MP4V-ES' Sending request: SETUP rtsp://158.39.162.136/my_stream.sdp/trackid=2 RTSP/1.0 CSeq: 4 Transport: RTP/AVP;unicast;client_port=32824-32825 Session: 3555079508826329464 User-Agent: VLC media player (LIVE555 Streaming Media v2007.02.20) Received SETUP response: RTSP/1.0 200 OK Server: QTSS/5.5.3 (Build/489.0.4; Platform/MacOSX; Release/Update; ) Cseq: 4 Session: 3555079508826329464 Cache-Control: no-cache Date: Thu, 10 Apr 2008 00:12:57 GMT Expires: Thu, 10 Apr 2008 00:12:57 GMT Transport: RTP/AVP;unicast;source=158.39.162.136;client_port=32824-32825;server_port=6970-6971 Sending request: PLAY rtsp://158.39.162.136/my_stream.sdp/ RTSP/1.0 CSeq: 5 Session: 3555079508826329464 Range: npt=0.000- User-Agent: VLC media player (LIVE555 Streaming Media v2007.02.20) Received PLAY response: RTSP/1.0 200 OK Server: QTSS/5.5.3 (Build/489.0.4; Platform/MacOSX; Release/Update; ) Cseq: 5 Session: 3555079508826329464 Range: npt=now- RTP-Info: url=rtsp://158.39.162.136/my_stream.sdp/trackid=1,url=rtsp://158.39.162.136/my_stream.sdp/trackid=2 [00000559] main input debug: selecting program id=0 [00000571] main demuxer debug: using access_demux module "live555" [00000574] main packetizer debug: looking for packetizer module: 33 candidates [00000574] packetizer_mpeg4audio packetizer debug: running MPEG4 audio packetizer [00000574] packetizer_mpeg4audio packetizer debug: AAC 44100Hz 1024 samples/frame [00000574] main packetizer debug: using packetizer module "packetizer_mpeg4audio" [00000559] main input debug: stream out mode -> no decoder thread [00000609] main packetizer debug: looking for packetizer module: 33 candidates [00000609] packetizer_mpeg4video packetizer debug: opening with vol size: 33 [00000609] main packetizer debug: using packetizer module "packetizer_mpeg4video" [00000559] main input debug: stream out mode -> no decoder thread [00000559] main input debug: starting in async mode [00000559] main input debug: `rtsp://158.39.162.136/my_stream.sdp' successfully opened [00000561] main stream output debug: adding a new input [00000562] stream_out_transcode private debug: creating video transcoding from fcc=`mp4v' to fcc=` ' [00000612] main decoder debug: looking for decoder module: 48 candidates [00000612] ffmpeg decoder debug: libavcodec initialized (interface 3352064 ) [00000612] ffmpeg decoder debug: postprocessing disabled [00000612] ffmpeg decoder debug: using direct rendering [00000612] ffmpeg decoder debug: ffmpeg codec (MPEG-4 Video) started [00000612] main decoder debug: using decoder module "ffmpeg" [00000613] main encoder debug: looking for encoder module: 1 candidate [00000613] main encoder debug: using encoder module "theora" [00000613] main encoder debug: removing module "theora" [00000612] ffmpeg decoder warning: warning: first frame is no keyframe (mpeg4@0xfa3e30) [00000562] stream_out_transcode private debug: decoder aspect is 576000:432000 [00000562] stream_out_transcode private debug: source pixel aspect is 1.000000:1 [00000562] stream_out_transcode private debug: scaled pixel aspect is 1.000000:1 [00000562] stream_out_transcode private debug: source 320x240, crop 320x240, destination 320x240, padding 320x240 [00000562] stream_out_transcode private debug: encoder aspect is 576000:432000 [00000613] main encoder debug: looking for encoder module: 1 candidate [00000613] main encoder debug: using encoder module "theora" [00000569] main private debug: adding a new input [00000569] mux_ogg private debug: adding input [00000569] mux_ogg private debug: theora stream Segmentation fault (core dumped)

ph0t0n
Blank Cone
Blank Cone
Posts: 81
Joined: 02 Apr 2008 22:36
VLC version: 0.8.6f
Operating System: Mac OS X 10.4.11
Location: Norway

Re: Transcoding from MPEG4/AAC to Theora/Vorbis

Postby ph0t0n » 21 May 2008 01:52

The solution to all this was to circumvent Darwin Streaming Server (and its massive delay + packet mangling ways) at least for the transcoding part, instead sending two streams from Wirecast. One to Darwin for streaming full quality MPEG/AAC to clients on the LAN, the other downscaled in size and bitrate to VLC for transcoding to Theora/Vorbis to clients on the Internet. VLC performs the transcoding and serves the resulting streams over HTTP at a chosen local IPv4 port, where Icecast picks them up (being configured as a slave relay). Using the VLC shout module just doesn't work properly. There are still issues of latency, delay, video artifacts, synchronization problems and the occasional crash, however, but we are somewhere to the ballpark now.


Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 5 guests