Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#1495 closed defect (fixed)

resample / ac3 encoding regression

Reported by: grolschie Owned by:
Priority: important Component: swresample
Version: git-master Keywords: regression ac3
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

I have noticed with recent ffmpeg builds, that converting the low quality YouTube? videos (H263 video with MP3) to AC3 Dolby Digital 2.0 @ 48,000hz and 44,100hz results in good audio in the right channel, but just digital noise on the left channel. Here is an example:


ffmpeg.exe -i "http://o-o.preferred.tnz-akl1.v20.ls
cache7.c.youtube.com/videoplayback?upn=-yli7TGCA4Q&sparams=algorithm%2Cburst%2Cc
p%2Cfactor%2Cid%2Cip%2Cipbits%2Citag%2Csource%2Cupn%2Cexpire&fexp=907048%2C92480
1%2C904102%2C906510%2C911205%2C902519%2C907217%2C907335%2C921602%2C919306%2C9226
00%2C919316%2C920704%2C924500%2C924700%2C913542%2C913547%2C919324%2C907344%2C912
706%2C902518&mt=1340913017&ms=au&algorithm=throttle-factor&itag=34&ip=219.0.0.0&
burst=40&sver=3&signature=57B4A269E25DC3DB60C3B7E82980F0853F6B362D.D349F29F2208E
B92D7624067EA655BBCF40FE2BC&source=youtube&expire=1340934623&key=yt1&ipbits=8&fa
ctor=1.25&cp=U0hTRVlOUl9HTUNOM19RSFZHOkIxakpzdXlzODA5&id=2e06a02833dcd0e2" -y -t
hreads 1 -copyts -c:v mpeg2video -qscale 3 -r 30000/1001 -g 15 -c:a ac3 -b:a 384
k -ar 48000 -ac 2 -map 0:0 -map 0:1 -sn -f vob output.vob
ffmpeg version N-42016-gc103dc0 Copyright (c) 2000-2012 the FFmpeg developers

built on Jun 28 2012 20:16:03 with gcc 4.7.1
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-ru

ntime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass

--enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable

-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libope
njpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libth
eora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-
libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --e
nable-zlib

libavutil 51. 63.100 / 51. 63.100
libavcodec 54. 29.101 / 54. 29.101
libavformat 54. 11.100 / 54. 11.100
libavdevice 54. 0.100 / 54. 0.100
libavfilter 3. 0.100 / 3. 0.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100

Input #0, flv, from 'http://o-o.preferred.tnz-akl1.v20.lscache7.c.youtube.com/vi
deoplayback?upn=-yli7TGCA4Q&sparams=algorithm%2Cburst%2Ccp%2Cfactor%2Cid%2Cip%2C
ipbits%2Citag%2Csource%2Cupn%2Cexpire&fexp=907048%2C924801%2C904102%2C906510%2C9
11205%2C902519%2C907217%2C907335%2C921602%2C919306%2C922600%2C919316%2C920704%2C
924500%2C924700%2C913542%2C913547%2C919324%2C907344%2C912706%2C902518&mt=1340913
017&ms=au&algorithm=throttle-factor&itag=34&ip=219.0.0.0&burst=40&sver=3&signatu
re=57B4A269E25DC3DB60C3B7E82980F0853F6B362D.D349F29F2208EB92D7624067EA655BBCF40F
E2BC&source=youtube&expire=1340934623&key=yt1&ipbits=8&factor=1.25&cp=U0hTRVlOUl
9HTUNOM19RSFZHOkIxakpzdXlzODA5&id=2e06a02833dcd0e2':

Metadata:

starttime : 0
totalduration : 209
totaldatarate : 601
bytelength : 15709754
canseekontime : true
sourcedata : B7A387304HH1340930999438436
purl :
pmsg :

Duration: 00:03:28.52, start: 0.000000, bitrate: 602 kb/s

Stream #0:0: Video: h264 (Main), yuv420p, 480x360 [SAR 1:1 DAR 4:3], 475 kb/

s, 25 tbr, 1k tbn, 50 tbc

Stream #0:1: Audio: aac, 44100 Hz, stereo, s16, 133 kb/s

Please use -q:a or -q:v, -qscale is ambiguous
[graph 0 input from stream 0:0 @ 024c9e80] w:480 h:360 pixfmt:yuv420p tb:1/1000
fr:25/1 sar:1/1 sws_param:flags=2
[output stream 0:0 @ 02c84200] No opaque field provided
[graph 1 input from stream 0:1 @ 02dadaa0] tb:1/1000 samplefmt:s16 samplerate:44
100 chlayout:0x3
[auto-inserted resampler 0 @ 02c60ee0] chl:stereo fmt:s16 r:44100Hz -> chl:stere
o fmt:flt r:48000Hz
[vob @ 02be4020] VBV buffer size not set, muxing may fail
Output #0, vob, to 'output.vob':

Metadata:

starttime : 0
totalduration : 209
totaldatarate : 601
bytelength : 15709754
canseekontime : true
sourcedata : B7A387304HH1340930999438436
purl :
pmsg :
encoder : Lavf54.11.100
Stream #0:0: Video: mpeg2video, yuv420p, 480x360 [SAR 1:1 DAR 4:3], q=2-31,

200 kb/s, 90k tbn, 29.97 tbc

Stream #0:1: Audio: ac3, 48000 Hz, stereo, flt, 384 kb/s

Stream mapping:

Stream #0:0 -> #0:0 (h264 -> mpeg2video)
Stream #0:1 -> #0:1 (aac -> ac3)

Press [q] to stop, ? for help
frame= 53 fps=0.0 q=3.0 size= 194kB time=00:00:01.70 bitrate= 933.9kbits/s
frame= 97 fps= 96 q=3.0 size= 420kB time=00:00:03.16 bitrate=1085.4kbits/s
frame= 134 fps= 87 q=3.0 size= 632kB time=00:00:04.40 bitrate=1175.5kbits/s
frame= 170 fps=0.0 q=3.0 size= 870kB time=00:00:05.60 bitrate=1271.4kbits/s
frame= 212 fps= 83 q=3.0 size= 1140kB time=00:00:07.00 bitrate=1332.8kbits/s
frame= 250 fps= 82 q=3.0 size= 1342kB time=00:00:08.27 bitrate=1328.6kbits/s
frame= 290 fps= 82 q=3.0 size= 1556kB time=00:00:09.60 bitrate=1326.5kbits/s
frame= 325 fps= 81 q=3.0 Lsize= 1780kB time=00:00:10.81 bitrate=1348.8kbits/
s dup=54 drop=0
video:1243kB audio:508kB subtitle:0 global headers:0kB muxing overhead 1.632107%


Here is the resulting file:
https://sites.google.com/site/grolschie/output.vob

The noise is quite loud and possibly bad for speakers.

Strangly, converting to 22050hz audio seems fine though.

Change History (6)

comment:1 Changed 4 years ago by grolschie

System is Windows XP 32bit with AMD XP2800+ CPU. FFmpeg builds from here: http://ffmpeg.zeranoe.com/builds/

comment:2 Changed 4 years ago by cehoyos

  • Component changed from FFmpeg to undetermined
  • Version changed from unspecified to git-master

Please provide the input file (output files are typically not useful).

comment:3 Changed 4 years ago by grolschie

Thanks. It's a Youtube video (low quality H263+MP3), and these expire.

Anyways, I have grabbed a portion of another video which you can find here:

https://sites.google.com/site/grolschie/input.flv

And the resulting transcoded output file here:

https://sites.google.com/site/grolschie/output.vob
(same URL as previousl, but I have updated the file)

The output from ffmpeg when converting:


ffmpeg.exe -i input.flv -y -threads 1 -copyts -c:v
mpeg2video -q:v 3 -r 30000/1001 -g 15 -c:a ac3 -b:a 384k -ar 48000 -ac 2 -map 0:
0 -map 0:1 -sn -f vob output.vob
ffmpeg version N-42016-gc103dc0 Copyright (c) 2000-2012 the FFmpeg developers

built on Jun 28 2012 20:16:03 with gcc 4.7.1
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-ru

ntime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass

--enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable

-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libope
njpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libth
eora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-
libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --e
nable-zlib

libavutil 51. 63.100 / 51. 63.100
libavcodec 54. 29.101 / 54. 29.101
libavformat 54. 11.100 / 54. 11.100
libavdevice 54. 0.100 / 54. 0.100
libavfilter 3. 0.100 / 3. 0.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100

Input #0, flv, from 'input.flv':

Metadata:

starttime : 0
totalduration : 55
totaldatarate : 362
bytelength : 2482969
canseekontime : true
sourcedata : B7A387386HH1341009589169369
purl :
pmsg :
encoder : Lavf54.11.100

Duration: 00:00:44.25, start: 0.000000, bitrate: 351 kb/s

Stream #0:0: Video: flv1, yuv420p, 426x240, 200 kb/s, 29.97 tbr, 1k tbn, 1k

tbc

Stream #0:1: Audio: mp3, 22050 Hz, stereo, s16, 64 kb/s

[graph 0 input from stream 0:0 @ 0237e820] w:426 h:240 pixfmt:yuv420p tb:1/1000
fr:30000/1001 sar:0/1 sws_param:flags=2
[output stream 0:0 @ 0237ef40] No opaque field provided
[graph 1 input from stream 0:1 @ 0237fac0] tb:1/1000 samplefmt:s16 samplerate:22
050 chlayout:0x3
[auto-inserted resampler 0 @ 023738c0] chl:stereo fmt:s16 r:22050Hz -> chl:stere
o fmt:flt r:48000Hz
[vob @ 028f0020] VBV buffer size not set, muxing may fail
Output #0, vob, to 'output.vob':

Metadata:

starttime : 0
totalduration : 55
totaldatarate : 362
bytelength : 2482969
canseekontime : true
sourcedata : B7A387386HH1341009589169369
purl :
pmsg :
encoder : Lavf54.11.100
Stream #0:0: Video: mpeg2video, yuv420p, 426x240, q=2-31, 200 kb/s, 90k tbn,

29.97 tbc

Stream #0:1: Audio: ac3, 48000 Hz, stereo, flt, 384 kb/s

Stream mapping:

Stream #0:0 -> #0:0 (flv -> mpeg2video)
Stream #0:1 -> #0:1 (mp3 -> ac3)

Press [q] to stop, ? for help
frame= 109 fps=0.0 q=3.0 size= 410kB time=00:00:03.57 bitrate= 940.8kbits/s
frame= 235 fps=0.0 q=3.0 size= 942kB time=00:00:07.77 bitrate= 992.6kbits/s
frame= 362 fps=241 q=3.0 size= 1440kB time=00:00:12.01 bitrate= 982.1kbits/s
frame= 477 fps=238 q=3.0 size= 1930kB time=00:00:15.84 bitrate= 997.6kbits/s
frame= 588 fps=235 q=3.0 size= 2518kB time=00:00:19.55 bitrate=1055.0kbits/s
frame= 688 fps=229 q=3.0 size= 3076kB time=00:00:22.88 bitrate=1100.9kbits/s
frame= 800 fps=229 q=3.0 size= 3594kB time=00:00:26.62 bitrate=1105.7kbits/s
frame= 907 fps=227 q=3.0 size= 4176kB time=00:00:30.19 bitrate=1132.9kbits/s
frame= 1021 fps=227 q=3.0 size= 4716kB time=00:00:34.00 bitrate=1136.3kbits/s
frame= 1125 fps=225 q=3.0 size= 5274kB time=00:00:37.47 bitrate=1153.0kbits/s
frame= 1232 fps=224 q=3.0 size= 5838kB time=00:00:41.04 bitrate=1165.3kbits/s
frame= 1312 fps=227 q=3.0 Lsize= 6114kB time=00:00:43.73 bitrate=1145.1kbits/
s dup=2 drop=0
video:3969kB audio:2050kB subtitle:0 global headers:0kB muxing overhead 1.566784
%


The input.flv plays fine. The converted output file has corrupted audio. I have previously tried transcoding to both 48,000hz and 44,100hz AC3 (Dolby Digital 2.0) and it has the same problem. Transcoding to 22050hz seemed fine though.

I hope that this helps. Please let me know if you need any more info/testing from me. :-)

comment:4 Changed 4 years ago by cehoyos

  • Component changed from undetermined to swresample
  • Keywords regression ac3 added
  • Reproduced by developer set
  • Status changed from new to open
  • Summary changed from H263+MP3 -> .vob (MPEG2 + AC3) = corrupt audio to resample / ac3 encoding regression

Regression since 4ccf6e3, not reproducible with wav and mp2

$ ffmpeg -i input_stream.flv -ar 48k out.ac3
ffmpeg -i input_stream.flv -ar 48k out.ac3
ffmpeg version N-42057-g8a85660 Copyright (c) 2000-2012 the FFmpeg developers
  built on Jun 30 2012 10:59:19 with gcc 4.3.2
  configuration: --cc=/usr/local/gcc-4.3.2/bin/gcc --enable-gpl --enable-libopenjpeg --enable-libvorbis --enable-libspeex --enable-libmp3lame --enable-libtheora --extra-ldflags=-lm --enable-libvpx --enable-libxavs --enable-libfaac --enable-nonfree
  libavutil      51. 63.100 / 51. 63.100
  libavcodec     54. 31.100 / 54. 31.100
  libavformat    54. 14.100 / 54. 14.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     3.  0.100 /  3.  0.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, flv, from 'input_stream.flv':
  Metadata:
    metadatacreator : Yet Another Metadata Injector for FLV - Version 1.4
    hasKeyframes    : true
    hasVideo        : true
    hasAudio        : true
    hasMetadata     : true
    canSeekToEnd    : true
    datasize        : 1978772
    videosize       : 1716367
    audiosize       : 254789
    lasttimestamp   : 30
    lastkeyframetimestamp: 30
    lastkeyframelocation: 1975246
    encoder         : Lavf54.11.100
  Duration: 00:00:30.27, start: 0.000000, bitrate: 366 kb/s
    Stream #0:0: Video: flv1, yuv420p, 450x360, 200 kb/s, 25 tbr, 1k tbn, 1k tbc
    Stream #0:1: Audio: mp3, 22050 Hz, stereo, s16, 64 kb/s
[graph 0 input from stream 0:1 @ 0x90cbf80] tb:1/1000 samplefmt:s16 samplerate:22050 chlayout:0x3
[auto-inserted resampler 0 @ 0x90d3f60] chl:stereo fmt:s16 r:22050Hz -> chl:stereo fmt:flt r:48000Hz
Output #0, ac3, to 'out.ac3':
  Metadata:
    metadatacreator : Yet Another Metadata Injector for FLV - Version 1.4
    hasKeyframes    : true
    hasVideo        : true
    hasAudio        : true
    hasMetadata     : true
    canSeekToEnd    : true
    datasize        : 1978772
    videosize       : 1716367
    audiosize       : 254789
    lasttimestamp   : 30
    lastkeyframetimestamp: 30
    lastkeyframelocation: 1975246
    encoder         : Lavf54.14.100
    Stream #0:0: Audio: ac3, 48000 Hz, stereo, flt, 192 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (mp3 -> ac3)
Press [q] to stop, [?] for help
size=     698kB time=00:00:29.75 bitrate= 192.0kbits/s
video:0kB audio:698kB subtitle:0 global headers:0kB muxing overhead 0.000000%

comment:5 Changed 4 years ago by michael

  • Resolution set to fixed
  • Status changed from open to closed

Fixed locally, will be in my next git push

comment:6 Changed 4 years ago by grolschie

I have tested it on my system this with this binary:

http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20120706-git-8293a21-win32-static.7z

It's fixed! Thank you so much!

Note: See TracTickets for help on using tickets.