Page 1 of 1

How to transcode or copy audio for RTSP stream?

PostPosted: Fri May 09, 2014 11:14 am
by cocowalla
I'm trying to configure Serviio to restream an RSTP webcam feed. Video works, but I don't get any audio. ffmpeg -i says:

  Code:
Guessed Channel Layout for  Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://xxx:xxx@192.168.x.x:xxxx/0/av0':
  Metadata:
    title           : h264.mp4
    comment         : TAS-Tech Live Cast
  Duration: N/A, start: 0.000000, bitrate: 64 kb/s
    Stream #0:0: Video: h264 (Baseline), yuvj420p(pc), 1280x720, 30 fps, 15 tbr, 90k tbn, 60 tbc
    Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s                                   


I've enabeled debug logging and see:

  Code:
DEBUG [VideoDeliveryEngine] Found Format profile for transcoded file rtsp://xxx:xxx@192.168.x.x:xxxx/0/av0: MPEG_PS_PAL
DEBUG [VideoDeliveryEngine] Found Format profile for transcoded file rtsp://xxx:xxx@192.168.x.x:xxxx/0/av0: MPEG_PS_NTSC
WARN  [GETMethodProcessor] A range header was found on the incoming request for a live stream, sending back the whole stream
DEBUG [AbstractTranscodingDeliveryEngine] No suitable transcoding job exists yet, start one for client 'Identifier=192.168.0.5, Profile=Generic DLNA profile'
DEBUG [FFMPEGWrapper] Invoking FFmpeg to transcode video file: rtsp://xxx:xxx@192.168.x.x:xxxx/0/av0
DEBUG [ProcessExecutor] Starting C:\Program Files\Video\Serviio\bin\\..\lib/ffmpeg.exe -rtsp_transport +tcp+udp -analyzeduration 10000000 -threads auto -i rtsp://xxx:xxx@192.168.x.x:xxxx/0/av0 -y -threads auto -c:v mpeg2video -pix_fmt yuv420p -qscale:v 1 -r 24000/1001 -g 15 -an -map 0:0 -sn -f vob pipe:


If I'm not mistaken, the ffmpeg flag '-an' strips out the audio.

In profiles.xml I see this in OnlineTranscoding for the 'Generic DLNA Profile':

  Code:
<Video targetContainer="mpeg" targetVCodec="mpeg2video" targetACodec="ac3" aBitrate="384" forceInheritance="true">
  <Matches container="rtp"/>
  <Matches container="rtsp"/>
  <Matches container="applehttp"/>
</Video>


I would have thought that would mean Serviio would copy the video and transcode the audio to AC3 in this case. But it's not doing that.

How can I get Serviio to (I might need to try both):

a) Copy the audio stream, instead of exclude it?
b) Transcode the audio stream into AAC or MP3?

Re: How to transcode or copy audio for RTSP stream?

PostPosted: Fri May 09, 2014 12:21 pm
by zip
I think pcm_alaw is not supported yet. I'll have a look at adding it.

Re: How to transcode or copy audio for RTSP stream?

PostPosted: Fri May 09, 2014 12:41 pm
by cocowalla
zip wrote:I think pcm_alaw is not supported yet. I'll have a look at adding it.


It didn't work with the bundled ffmpeg, but I replaced it with a later version and ffmpeg seems OK with it. But it still doesn't work in Serviio.

Is there any workaround?

Re: How to transcode or copy audio for RTSP stream?

PostPosted: Fri May 16, 2014 2:13 pm
by zip
So this should already be supported. The -an parameter is added when Serviio cannot work out the audio codec of the stream, but running your output through my tests, it should work.

I'm not sure if FFmpeg perhaps could not get the audio info from the stream originally, but managed later?

Re: How to transcode or copy audio for RTSP stream?

PostPosted: Fri May 23, 2014 11:00 am
by cocowalla
The original ffmpeg did return an error about the audio, but the new one does not.

Still it transcodes the video and there is no audio.