Page 1 of 1

Transcoded audio out of sync when 48000Hz 112kb/s

PostPosted: Mon Nov 15, 2010 4:15 pm
by spawn57
When I try to play a avi file with the following audio encoding, the audio is always out of sync with the video. It's always about 1 second behind. I've tried this out on 2-3 video files already.:

Stream #0.1: Audio: mp3, 48000 Hz, stereo, s16, 112 kb/s


The problem occurs on both the PS3 and a Sony Bravia TV W5500

Re: Transcoded audio out of sync when 48000Hz 112kb/s

PostPosted: Mon Nov 15, 2010 10:35 pm
by zip
what do you transcode into? or is it just rewrapping? is your PC strong enough to transcode in real time?

Re: Transcoded audio out of sync when 48000Hz 112kb/s

PostPosted: Tue Nov 16, 2010 4:50 am
by spawn57
I'm not sure if it's rewrapping.

My PC is definitely strong enough handle the transcoding, I've played different movies about the same quality and it played them without a hitch. Also I checked the processor usage and it's around the 60%.

It's transcoding to mpeg2 for my TV. I set serviio's profile to Sony Bravia TV.

I've also played the movie on my ps3 using another DLNA framework (coherence) which does not do any transcoding. The movie plays without any audio.

Re: Transcoded audio out of sync when 48000Hz 112kb/s

PostPosted: Tue Nov 16, 2010 8:22 am
by Illico
spawn57 wrote:The problem occurs on both the PS3 and a Sony Bravia TV W5500

Could you check the detailed serviio.log file ? viewtopic.php?f=5&t=7
Look at the line where ffmpeg transcode the source file into a temporary directories, something like:
2010-10-12 20:40:33,000 DEBUG [ProcessExecutor] Starting C:\Serviio\bin\\..\lib/ffmpeg.exe -i <input_file> -y -vcodec copy -copyts -acodec ac3 -ab 192k -vbsf h264_mp4toannexb -sn -f mpegts C:\WINDOWS\TEMP\Serviio\transcoding-temp-1071-MPEG2TS.stf
And post the section (10 lines before, and 10 lines after) here, please.

Re: Transcoded audio out of sync when 48000Hz 112kb/s

PostPosted: Thu Nov 18, 2010 4:41 pm
by spawn57
Got the l


2010-11-19 00:37:13,389 DEBUG [ResourceTransportRequestHandler] GET /resource/8390/MEDIA_ITEM/MPEG_TS_SD_EU_ISO HTTP/1.1, headers = [TimeSeekRange.dlna.org: npt=0.000-, getcontentFeatures.dlna.org: 1, Pragma: getIfoFileURI.dlna.org, transferMode.dlna.org: Streaming, Host: 192.168.1.2:8895, ]
2010-11-19 00:37:13,390 DEBUG [ResourceTransportRequestHandler] Resource request accepted. Using client 'IPAddress=/192.168.1.100, Profile=Sony Bravia TV'og,
2010-11-19 00:37:13,390 DEBUG [ResourceTransportRequestHandler] Request for resource 8390 and type 'MEDIA_ITEM' received
2010-11-19 00:37:13,390 DEBUG [MediaItemDAOImpl] Reading a MediaItem (id = 8390)
2010-11-19 00:37:13,390 DEBUG [VideoDAOImpl] Reading a Video (id = 8390)
2010-11-19 00:37:13,391 DEBUG [VideoDeliveryEngine] Delivering item '8390' for client 'IPAddress=/192.168.1.100, Profile=Sony Bravia TV'
2010-11-19 00:37:13,391 DEBUG [VideoDeliveryEngine] Delivering file 'Pineapple Express.avi' using transcoding
2010-11-19 00:37:13,391 DEBUG [VideoDeliveryEngine] Stopping previous transcoding job of file '/var/tmp/Serviio/transcoding-temp-8391-MPEG2TS.stf'
2010-11-19 00:37:13,391 DEBUG [ProcessExecutor] Stopping external process: Thread[Thread-150,5,main]
2010-11-19 00:37:13,391 DEBUG [TranscodingJobListener] Transcoding finished; successful: false
2010-11-19 00:37:13,392 DEBUG [VideoDeliveryEngine] Deleted temp file '/var/tmp/Serviio/transcoding-temp-8391-MPEG2TS.stf': true
2010-11-19 00:37:13,392 DEBUG [VideoDeliveryEngine] No suitable transcoding job exists yet, start one for client 'IPAddress=/192.168.1.100, Profile=Sony Bravia TV'
2010-11-19 00:37:13,392 DEBUG [MediaItemDAOImpl] Getting file of media item 8390
2010-11-19 00:37:13,392 DEBUG [FFMPEGWrapper] Invoking FFmpeg to transcode file: /home/share/movies/Pineapple Express.avi
2010-11-19 00:37:13,397 DEBUG [ProcessExecutor] Starting ffmpeg -threads 1 -i /home/share/movies/Pineapple Express.avi -y -vcodec mpeg2video -sameq -r 23.98 -g 15 -copyts -acodec ac3 -ab 192k -sn -f mpegts /var/tmp/Serviio/transcoding-temp-8390-MPEG2TS.stf
2010-11-19 00:37:13,405 WARN [OutputTextReader] Error reading output of an external command:Bad file descriptor
2010-11-19 00:37:13,898 DEBUG [VideoDeliveryEngine] Found Format profile for transcoded file Pineapple Express.avi: MPEG_TS_SD_EU_ISO
2010-11-19 00:37:13,898 DEBUG [VideoDeliveryEngine] Found Format profile for transcoded file Pineapple Express.avi: MPEG_TS_SD_NA_ISO
2010-11-19 00:37:13,898 DEBUG [VideoDeliveryEngine] Found Format profile for transcoded file Pineapple Express.avi: MPEG_TS_SD_KO_ISO
2010-11-19 00:37:13,898 DEBUG [VideoDeliveryEngine] Sending transcoding stream
2010-11-19 00:37:13,898 DEBUG [MediaItemDAOImpl] Marking MediaItem (id = 8390) as read
2010-11-19 00:37:13,929 DEBUG [LocalContentCacheDecorator] Cleared cache (local_resetafterplay)
2010-11-19 00:37:13,929 DEBUG [ResourceTransportRequestHandler] Creating stream entity with length: 9000000000
2010-11-19 00:37:13,929 DEBUG [ResourceTransportRequestHandler] Creating entity with chunked transfer
2010-11-19 00:37:13,929 DEBUG [ResourceTransportRequestHandler] Sending file back
2010-11-19 00:37:13,929 DEBUG [ResourceTransportRequestHandler] HTTP/1.1 200 OK, headers = [Content-Type: video/mpeg, TimeSeekRange.dlna.org: npt=0-6724/6724, Date: Thu, 18 Nov 2010 16:37:13 GMT, Server: Linux, UPnP/1.0 DLNADOC/1.50, Serviio/0.4.2, Cache-control: no-cache, contentFeatures.dlna.org: DLNA.ORG_PN=MPEG_TS_SD_EU_ISO;DLNA.ORG_OP=10;DLNA.ORG_CI=1;DLNA.ORG_FLAGS=01500000000000000000000000000000, transferMode.dlna.org: Streaming, ]
2010-11-19 00:37:16,824 DEBUG [WebServer] I/O error: Connection reset
2010-11-19 00:37:16,837 DEBUG [WebServer] Incoming connection from /192.168.1.100:61603
2010-11-19 00:37:16,838 DEBUG [ResourceTransportRequestHandler] GET /resource/8390/MEDIA_ITEM/MPEG_TS_SD_EU_ISO HTTP/1.1, headers = [TimeSeekRange.dlna.org: npt=362.002-, getcontentFeatures.dlna.org: 1, Pragma: getIfoFileURI.dlna.org, transferMode.dlna.org: Streaming, Host: 192.168.1.2:8895, ]
2010-11-19 00:37:16,839 DEBUG [ResourceTransportRequestHandler] Resource request accepted. Using client 'IPAddress=/192.168.1.100, Profile=Sony Bravia TV'
2010-11-19 00:37:16,839 DEBUG [ResourceTransportRequestHandler] Request for resource 8390 and type 'MEDIA_ITEM' received
2010-11-19 00:37:16,839 DEBUG [MediaItemDAOImpl] Reading a MediaItem (id = 8390)
2010-11-19 00:37:16,840 DEBUG [VideoDAOImpl] Reading a Video (id = 8390)
2010-11-19 00:37:16,840 DEBUG [VideoDeliveryEngine] Delivering item '8390' for client 'IPAddress=/192.168.1.100, Profile=Sony Bravia TV'
2010-11-19 00:37:16,840 DEBUG [VideoDeliveryEngine] Delivering file 'Pineapple Express.avi' using transcoding
2010-11-19 00:37:16,841 DEBUG [VideoDeliveryEngine] A suitable transcoding job already exists, re-use it for client 'IPAddress=/192.168.1.100, Profile=Sony Bravia TV'
2010-11-19 00:37:16,841 DEBUG [VideoDeliveryEngine] Found Format profile for transcoded file Pineapple Express.avi: MPEG_TS_SD_EU_ISO
2010-11-19 00:37:16,841 DEBUG [VideoDeliveryEngine] Found Format profile for transcoded file Pineapple Express.avi: MPEG_TS_SD_NA_ISO
2010-11-19 00:37:16,841 DEBUG [VideoDeliveryEngine] Found Format profile for transcoded file Pineapple Express.avi: MPEG_TS_SD_KO_ISO
2010-11-19 00:37:16,841 DEBUG [VideoDeliveryEngine] Sending transcoding stream
2010-11-19 00:37:16,841 DEBUG [ResourceTransportRequestHandler] Creating stream entity with length: 1017696206
2010-11-19 00:37:16,841 DEBUG [ResourceTransportRequestHandler] Creating entity with chunked transfer
2010-11-19 00:37:16,841 DEBUG [ResourceTransportRequestHandler] Sending file back
2010-11-19 00:37:16,842 DEBUG [ResourceTransportRequestHandler] HTTP/1.1 200 OK, headers = [Content-Type: video/mpeg, TimeSeekRange.dlna.org: npt=362-6724/6724, Date: Thu, 18 Nov 2010 16:37:16 GMT, Server: Linux, UPnP/1.0 DLNADOC/1.50, Serviio/0.4.2, Cache-control: no-cache, contentFeatures.dlna.org: DLNA.ORG_PN=MPEG_TS_SD_EU_ISO;DLNA.ORG_OP=10;DLNA.ORG_CI=1;DLNA.ORG_FLAGS=01500000000000000000000000000000, transferMode.dlna.org: Streaming,

Re: Transcoded audio out of sync when 48000Hz 112kb/s

PostPosted: Thu Nov 18, 2010 7:38 pm
by Illico
Could you transcode the avi file localy with following comand line
ffmpeg -i /home/share/movies/Pineapple Express.avi -y -vcodec mpeg2video -sameq -r 23.98 -g 15 -copyts -acodec ac3 -ab 192k -sn -f mpegts /var/tmp/Serviio/Test_192k.ts
Try to read Test_192k.ts file with WMP, VLC or MediaPlayerClassic on PC, and add it into Serviio library to check direct streaming to the TV.

You could also try with this audio option
ffmpeg -i /home/share/movies/Pineapple Express.avi -y -vcodec mpeg2video -sameq -r 23.98 -g 15 -copyts -acodec ac3 -ab 384k -sn -f mpegts /var/tmp/Serviio/Test_384k.ts

Re: Transcoded audio out of sync when 48000Hz 112kb/s

PostPosted: Thu Nov 18, 2010 7:49 pm
by Illico
Oh what is your OS ? ffmpeg version ?
Could you also provide the ffmpeg -i /home/share/movies/Pineapple Express.avi command result?

Re: Transcoded audio out of sync when 48000Hz 112kb/s

PostPosted: Fri Nov 19, 2010 2:10 am
by spawn57
Using ubuntu 10.04 LTS. I'll provide you with the ffmpeg -i version as soon as I get a chance...

Re: Transcoded audio out of sync when 48000Hz 112kb/s

PostPosted: Fri Nov 19, 2010 8:13 am
by Illico
Its probably a ffmpeg version issue, have a look on this http://www.serviio.org/download
This release includes FFmpeg (rev. 23013, incl. a patch) compiled using this source code.

Re: Transcoded audio out of sync when 48000Hz 112kb/s

PostPosted: Fri Nov 19, 2010 4:51 pm
by spawn57
FFmpeg version SVN-r0.5.1-4:0.5.1-1ubuntu1, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --extra-version=4:0.5.1-1ubuntu1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
libavutil 49.15. 0 / 49.15. 0
libavcodec 52.20. 1 / 52.20. 1
libavformat 52.31. 0 / 52.31. 0
libavdevice 52. 1. 0 / 52. 1. 0
libavfilter 0. 4. 0 / 0. 4. 0
libswscale 0. 7. 1 / 0. 7. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Mar 4 2010 12:35:30, gcc: 4.4.3
Input #0, avi, from '/home/share/movies/Pineapple Express.avi':
Duration: 01:52:04.68, start: 0.000000, bitrate: 875 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 664x268 [PAR 1:1 DAR 166:67], 23.98 tbr, 23.98 tbn, 23.98 tbc
Stream #0.1: Audio: mp3, 48000 Hz, stereo, s16, 112 kb/s
At least one output file must be specified

Re: Transcoded audio out of sync when 48000Hz 112kb/s

PostPosted: Sat Nov 27, 2010 12:29 pm
by spawn57
Hi,

I've tried the following command:

ffmpeg -i /home/share/movies/Pineapple Express.avi -y -vcodec mpeg2video -sameq -r 23.98 -g 15 -copyts -acodec ac3 -ab 192k -sn -f mpegts /var/tmp/Serviio/Test_192k.ts

It plays fine, but the audio is still out of sync. Anythign else I can try?

Re: Transcoded audio out of sync when 48000Hz 112kb/s

PostPosted: Sat Nov 27, 2010 12:54 pm
by Illico
spawn57 wrote:Hi,...It plays fine, but the audio is still out of sync. Anythign else I can try?

Do you try this ?
ffmpeg -i /home/share/movies/Pineapple Express.avi -y -vcodec mpeg2video -sameq -r 23.98 -g 15 -copyts -acodec ac3 -ab 384k -sn -f mpegts /var/tmp/Serviio/Test_384k.ts

Re: Transcoded audio out of sync when 48000Hz 112kb/s

PostPosted: Mon Nov 29, 2010 7:09 am
by tombert
some of my videos went out of sync when I forced a framerate ... you could try to ommit -r option

Re: Transcoded audio out of sync when 48000Hz 112kb/s

PostPosted: Tue Nov 30, 2010 2:27 am
by spawn57
Illico wrote:
spawn57 wrote:Hi,...It plays fine, but the audio is still out of sync. Anythign else I can try?

Do you try this ?
ffmpeg -i /home/share/movies/Pineapple Express.avi -y -vcodec mpeg2video -sameq -r 23.98 -g 15 -copyts -acodec ac3 -ab 384k -sn -f mpegts /var/tmp/Serviio/Test_384k.ts


didn't work either. The video is still out of sync.

Re: Transcoded audio out of sync when 48000Hz 112kb/s

PostPosted: Tue Nov 30, 2010 8:06 am
by Illico
spawn57 wrote:Didn't work either. The video is still out of sync.

Did you change your ffmpeg version with FFmpeg (rev. 23013, incl. a Serviio patch)?

Re: Transcoded audio out of sync when 48000Hz 112kb/s

PostPosted: Sun Dec 05, 2010 11:12 am
by mbrust
same problem, but I did not change the ffmpeg version yet.
reason: I am not able to compile the source code.
Is there is binary version for a QNAP 119 available somewhere?
thanks
Mike