Ticket #1630 (closed defect: fixed)

Opened 3 months ago

Last modified 1 month ago

When transcoding video and audio with the mp3 module, audio is slowed down rather than resampled

Reported by: stealthdave Assigned to:
Priority: normal Milestone: 0.9.0 bugs
Component: Stream output Version: master
Severity: normal Keywords: audio stream mp3
Cc: Platform(s): all
Difficulty: unknown Work status: Not started

Description

The video plays at normal speed. Rather than resampling the audio, vlc is slowing down the audio to match the requested samplerate. In order to keep up with the video, vlc is dropping pieces of the audio. This keeps the video and audio in sync (well done), but makes videos of my wife sound like James Earl Jones (not so well done ;) ). The build was from git latest as of a couple of hours ago. The command-line used to initiate streaming is:

/Users/stealthdave/Source/vlc/VLC.app/Contents/MacOS/VLC -vvv -I http \
    --http-src /Users/stealthdave/Projects/tystreamer.local/httpdocs/demo/controls/ \
    --http-host :8091 /Users/stealthdave/Movies/makeup.wmv \
    --sout #transcode{vcodec=FLV1,acodec=mp3,samplerate=22050,ab=64,vb=256,width=320,height=240,channels=2}:std{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=0.0.0.0:8090/stream.flv} \
    --file-logging --logfile tystreamer.log

Attachments

tystreamer.log.gz (80.2 kB) - added by stealthdave on 06/21/08 23:43:36.

Change History

06/21/08 23:43:36 changed by stealthdave

  • attachment tystreamer.log.gz added.

06/28/08 14:22:50 changed by courmisch

  • milestone set to 0.9.0 bugs.

You should probably use the scaletempo filter. Not sure if that fixes this issue though, but the only proper solution is to not transcode above your CPU capacity (or not in real-time).

06/28/08 20:38:24 changed by stealthdave

Got latest and recompiled adding "--audio-filter scaletempo" to the command-line, but the problem persists. I do not believe that this is a CPU issue, as I am able to replicate the problem precisely on two very different systems. System 1: AMD Sempron 64 2800 w/ 1.5G RAM running Ubuntu 8.04. System 2: 2.16 GHz Intel Core Duo MacBook? Pro w/ 2G RAM running Mac OS X 10.5.3. Playback on both systems is identical, right down to the pitch and playback speed.

One correction to the initial report. The --sout portion command-line should be contained within double-quotes.

07/03/08 02:24:25 changed by trax

Tested with nightly build vlc-0.9.0-test2-20080702-1913-win32.zip

Seeing same behavior with FLV1/mp3 realtime. CPU is not maxed out (under 10%). you can hear subtle "clicking" sounds in audio, probably the places you mention where data is dropped. Also there is a heavy desync going on. Within a few seconds it's already noticable. Tried audio-sync option, other sampling rates, other bitrates and channels 2 or 1 but nothing helps.

07/06/08 01:15:32 changed by stealthdave

  • summary changed from When transcoding audio for flash streaming, audio is slowed down rather than resampled to When transcoding for flash video format, audio is slowed down rather than resampled.

Also tested with transcoding to file:

./VLC.app/Contents/MacOS/VLC -vvv -I dummy ~/Movies/test.ty --sout "#transcode{vcodec=FLV1,acodec=mp3,samplerate=22050,ab=128,vb=512,width=320,height=240,channels=2}:std{access=file,mux=ffmpeg{mux=flv},dst=stream.flv}" vlc://quit

Slow audio is present even when transcoding to file as opposed to streaming.

(Updated bug summary to reflect this testing.)

07/08/08 01:48:15 changed by stealthdave

  • summary changed from When transcoding for flash video format, audio is slowed down rather than resampled to When transcoding video and audio with the mp3 module, audio is slowed down rather than resampled.

Tested a stand-alone build of ffmpeg svn -r 14080 (used in contribs for 0.9.0) to make sure that it wasn't a problem with ffmpeg library. The following command-line created a good flv video file with audio playback at the correct speed:

ffmpeg -i ~/Movies/makeup.wmv -acodec mp3lame -ab 128k -ar 22050 -vcodec flv -b 512k ~/Movies/makeup.flv

I believe that the problem lies in the mp3 encoding. When I using the following command-line to create an avi file:

./VLC.app/Contents/MacOS/VLC -vvv -I dummy ~/Movies/makeup.wmv \
    --sout "#transcode{vcodec=mp4v,acodec=mp3,samplerate=22050,ab=128,vb=512,width=320,height=240,channels=2}:std{access=file,dst=stream.mov}" vlc://quit

This creates a movie that can be played back in QuickTime? with video at the correct speed and audio at a much slower rate. Adding "--audio-filter scaletempo" has no effect.

07/08/08 01:48:30 changed by stealthdave

  • keywords changed from audio stream flash to audio stream mp3.

08/10/08 13:26:42 changed by hartman

  • status changed from new to closed.
  • resolution set to fixed.