using -qscale in ffmpeg doesn't have any effect on coding

Bug #356322 reported by Nido Media
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
FFmpeg
Fix Released
Undecided
Unassigned
ffmpeg (Ubuntu)
Fix Released
Medium
Reinhard Tartler

Bug Description

Binary package hint: ffmpeg

using ffmpeg comming with ubuntu jaunty (which is FFmpeg version
0.5=-svn17737+3:0.svn20090303-1ubuntu4); usage of the -qscale rather then -b
doesn't change the end result file size. In fact; coding a flv video five times
with qscale going from 1 to 5 has no effect; using 25 doesn't quite make the
video any smaller or less nice to watch.

Originally found this with trying to transcode vob mpeg to a theora; trying
-qmin, -qmax -sameq seems to have the same effect.

I guess the default of 200kb/s for the bitrate setting is taking precedence over
what's set for the quantizer

Here's some command line session which shows the problem. This isn't limited to vob -> flv; qscale doesn't work for theora->theora as well, (and probably a lot more, if not everything).

0 nido@toad:~/ for x in 1 2 3 4 5; do ffmpeg -y -i HARRY_POTTER_GOBLET_OF_FIRE1.vob -croptop 80 -cropbottom 80 -t 00:01:00 -ss 00:00:00 -an -sameq -f flv -qscale $x video$x.flv; done

FFmpeg version 0.5-svn17737+3:0.svn20090303-1ubuntu4, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --extra-version=svn17737+3:0.svn20090303-1ubuntu4 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --disable-stripping --disable-vhook --enable-libdc1394 --enable-shared --disable-static
  libavutil 49.15. 0 / 49.15. 0
  libavcodec 52.20. 0 / 52.20. 0
  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 23 2009 07:13:25, gcc: 4.3.3

Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1) -> 25.00 (25/1)
Input #0, mpeg, from 'HARRY_POTTER_GOBLET_OF_FIRE1.vob':
  Duration: 01:15:42.86, start: 0.052000, bitrate: 12699 kb/s
    Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 720x576 [PAR 64:45 DAR 16:9], 7500 kb/s, 25 tbr, 90k tbn, 50 tbc
    Stream #0.1[0x80]: Audio: ac3, 48000 Hz, 5.1, s16, 384 kb/s
    Stream #0.2[0x81]: Audio: ac3, 0 channels, s16
Output #0, flv, to 'video1.flv':
    Stream #0.0: Video: flv, yuv420p, 720x416 [PAR 227:221 DAR 10215:5746], q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
frame= 1501 fps=103 q=0.0 Lsize= 12920kB time=60.04 bitrate=1762.8kbits/s
video:12896kB audio:0kB global headers:0kB muxing overhead 0.183273%
FFmpeg version 0.5-svn17737+3:0.svn20090303-1ubuntu4, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --extra-version=svn17737+3:0.svn20090303-1ubuntu4 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --disable-stripping --disable-vhook --enable-libdc1394 --enable-shared --disable-static
  libavutil 49.15. 0 / 49.15. 0
  libavcodec 52.20. 0 / 52.20. 0
  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 23 2009 07:13:25, gcc: 4.3.3

Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1) -> 25.00 (25/1)
Input #0, mpeg, from 'HARRY_POTTER_GOBLET_OF_FIRE1.vob':
  Duration: 01:15:42.86, start: 0.052000, bitrate: 12699 kb/s
    Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 720x576 [PAR 64:45 DAR 16:9], 7500 kb/s, 25 tbr, 90k tbn, 50 tbc
    Stream #0.1[0x80]: Audio: ac3, 48000 Hz, 5.1, s16, 384 kb/s
    Stream #0.2[0x81]: Audio: ac3, 0 channels, s16
Output #0, flv, to 'video2.flv':
    Stream #0.0: Video: flv, yuv420p, 720x416 [PAR 227:221 DAR 10215:5746], q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
frame= 1501 fps= 98 q=0.0 Lsize= 12920kB time=60.04 bitrate=1762.8kbits/s
video:12896kB audio:0kB global headers:0kB muxing overhead 0.183273%
FFmpeg version 0.5-svn17737+3:0.svn20090303-1ubuntu4, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --extra-version=svn17737+3:0.svn20090303-1ubuntu4 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --disable-stripping --disable-vhook --enable-libdc1394 --enable-shared --disable-static
  libavutil 49.15. 0 / 49.15. 0
  libavcodec 52.20. 0 / 52.20. 0
  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 23 2009 07:13:25, gcc: 4.3.3

Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1) -> 25.00 (25/1)
Input #0, mpeg, from 'HARRY_POTTER_GOBLET_OF_FIRE1.vob':
  Duration: 01:15:42.86, start: 0.052000, bitrate: 12699 kb/s
    Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 720x576 [PAR 64:45 DAR 16:9], 7500 kb/s, 25 tbr, 90k tbn, 50 tbc
    Stream #0.1[0x80]: Audio: ac3, 48000 Hz, 5.1, s16, 384 kb/s
    Stream #0.2[0x81]: Audio: ac3, 0 channels, s16
Output #0, flv, to 'video3.flv':
    Stream #0.0: Video: flv, yuv420p, 720x416 [PAR 227:221 DAR 10215:5746], q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
frame= 1501 fps= 99 q=0.0 Lsize= 12920kB time=60.04 bitrate=1762.8kbits/s
video:12896kB audio:0kB global headers:0kB muxing overhead 0.183273%
FFmpeg version 0.5-svn17737+3:0.svn20090303-1ubuntu4, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --extra-version=svn17737+3:0.svn20090303-1ubuntu4 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --disable-stripping --disable-vhook --enable-libdc1394 --enable-shared --disable-static
  libavutil 49.15. 0 / 49.15. 0
  libavcodec 52.20. 0 / 52.20. 0
  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 23 2009 07:13:25, gcc: 4.3.3

Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1) -> 25.00 (25/1)
Input #0, mpeg, from 'HARRY_POTTER_GOBLET_OF_FIRE1.vob':
  Duration: 01:15:42.86, start: 0.052000, bitrate: 12699 kb/s
    Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 720x576 [PAR 64:45 DAR 16:9], 7500 kb/s, 25 tbr, 90k tbn, 50 tbc
    Stream #0.1[0x80]: Audio: ac3, 48000 Hz, 5.1, s16, 384 kb/s
    Stream #0.2[0x81]: Audio: ac3, 0 channels, s16
Output #0, flv, to 'video4.flv':
    Stream #0.0: Video: flv, yuv420p, 720x416 [PAR 227:221 DAR 10215:5746], q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
frame= 1501 fps=103 q=0.0 Lsize= 12920kB time=60.04 bitrate=1762.8kbits/s
video:12896kB audio:0kB global headers:0kB muxing overhead 0.183273%
FFmpeg version 0.5-svn17737+3:0.svn20090303-1ubuntu4, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --extra-version=svn17737+3:0.svn20090303-1ubuntu4 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --disable-stripping --disable-vhook --enable-libdc1394 --enable-shared --disable-static
  libavutil 49.15. 0 / 49.15. 0
  libavcodec 52.20. 0 / 52.20. 0
  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 23 2009 07:13:25, gcc: 4.3.3

Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1) -> 25.00 (25/1)
Input #0, mpeg, from 'HARRY_POTTER_GOBLET_OF_FIRE1.vob':
  Duration: 01:15:42.86, start: 0.052000, bitrate: 12699 kb/s
    Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 720x576 [PAR 64:45 DAR 16:9], 7500 kb/s, 25 tbr, 90k tbn, 50 tbc
    Stream #0.1[0x80]: Audio: ac3, 48000 Hz, 5.1, s16, 384 kb/s
    Stream #0.2[0x81]: Audio: ac3, 0 channels, s16
Output #0, flv, to 'video5.flv':
    Stream #0.0: Video: flv, yuv420p, 720x416 [PAR 227:221 DAR 10215:5746], q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
frame= 1501 fps=104 q=0.0 Lsize= 12920kB time=60.04 bitrate=1762.8kbits/s
video:12896kB audio:0kB global headers:0kB muxing overhead 0.183273%

0 nido@toad:~/ ls -la video[12345].flv
-rw-r--r-- 1 nido nido 13230180 2009-04-02 14:00 video1.flv
-rw-r--r-- 1 nido nido 13230180 2009-04-02 14:00 video2.flv
-rw-r--r-- 1 nido nido 13230180 2009-04-02 14:00 video3.flv
-rw-r--r-- 1 nido nido 13230180 2009-04-02 14:00 video4.flv
-rw-r--r-- 1 nido nido 13230180 2009-04-02 14:01 video5.flv

Revision history for this message
Reinhard Tartler (siretart) wrote : Re: [Bug 356322] [NEW] using -qscale in ffmpeg doesn't have any effect on coding

Nido Media <email address hidden> writes:

> using ffmpeg comming with ubuntu jaunty (which is FFmpeg version
> 0.5=-svn17737+3:0.svn20090303-1ubuntu4); usage of the -qscale rather then -b
> doesn't change the end result file size. In fact; coding a flv video five times
> with qscale going from 1 to 5 has no effect; using 25 doesn't quite make the
> video any smaller or less nice to watch.

could you please check if that also happens with the latest version from
trunk?

--
Gruesse/greetings,
Reinhard Tartler, KeyID 945348A4

Revision history for this message
Nido Media (nido) wrote :

it works with svn for flv video; theora video, however; still doesn't care about the quantizer:

for x in 1 5 25; do /home/nido/bin/programs/ffmpeg/bin/ffmpeg -y -vframes 250 -i in.flv -qscale $x -s vga out$x.flv; done
for x in 1 5 25; do /home/nido/bin/programs/ffmpeg/bin/ffmpeg -y -vframes 250 -i in.flv -qscale $x -s vga out$x.flv; done
ls -lh

-rw-r--r-- 1 nido nido 798K 2009-04-06 21:17 out1.avi
-rw-r--r-- 1 nido nido 5.2M 2009-04-06 21:18 out1.flv
-rw-r--r-- 1 nido nido 798K 2009-04-06 21:17 out25.avi
-rw-r--r-- 1 nido nido 1.1M 2009-04-06 21:18 out25.flv
-rw-r--r-- 1 nido nido 798K 2009-04-06 21:17 out5.avi
-rw-r--r-- 1 nido nido 2.5M 2009-04-06 21:18 out5.flv

Revision history for this message
Nido Media (nido) wrote :
Revision history for this message
Reinhard Tartler (siretart) wrote : Re: [Bug 356322] Re: using -qscale in ffmpeg doesn't have any effect on coding

okay, this means this needs forwarding upstream.

--
Gruesse/greetings,
Reinhard Tartler, KeyID 945348A4

Revision history for this message
Reinhard Tartler (siretart) wrote :

thanks for forwarding it. This is a better url: https://roundup.ffmpeg.org/roundup/ffmpeg/issue949

as soon as it has been fixed in HEAD we can consider backporting it to the 0.5 release.

Changed in ffmpeg (Ubuntu):
importance: Undecided → Wishlist
status: New → Confirmed
Changed in ffmpeg:
importance: Undecided → Unknown
status: New → Unknown
Changed in ffmpeg:
status: Unknown → Confirmed
Changed in ffmpeg:
status: Confirmed → Incomplete
Revision history for this message
Nido Media (nido) wrote :

May I know what is incomplete about this bug?

Revision history for this message
Paul Gevers (paul-climbing) wrote : Re: [Bug 356322] Re: using -qscale in ffmpeg doesn't have any effect on coding

You should look (and ask) upstream. That is where the incomplete message
come from. Except that upstream says closed/implemented and NOT
incomplete. This is probably a bug in Launchpad.

Paul

Nido Media wrote:
> May I know what is incomplete about this bug?
>

Revision history for this message
Reinhard Tartler (siretart) wrote :

this is the patch from upstream.

can someone test it? it looks good to me, so I'll add it to the package on the next upload

Changed in ffmpeg (Ubuntu):
status: Confirmed → Triaged
importance: Wishlist → Medium
Revision history for this message
Nido Media (nido) wrote :

356322.patch applies cleanly on ffmpeg-debian-0.svn20090303 (which i got from `apt-get source ffmpeg`). Testing compliling and running now

Revision history for this message
Nido Media (nido) wrote :

seems to work like a charm. What I did to accomplish this:

sudo su -
apt-get source ffmpeg
apt-get build-dep ffmpeg
cd ffmpeg-debian-0.svn20090303
dpkg-buildpackage -rfakeroot -uc -b
cd ..
dpkg -i *.deb

exit

for x in 1 5 25; do ffmpeg -y -vframes 250 -i in.avi -qscale $x -s vga out$x.ogg; done
ls -lah out*.ogg

output of the last command:
-rw-r--r-- 1 nido nido 865K Oct 2 15:23 out1.ogg
-rw-r--r-- 1 nido nido 2.3M Oct 2 15:23 out25.ogg
-rw-r--r-- 1 nido nido 1.2M Oct 2 15:23 out5.ogg

Seems like it's working.

Changed in ffmpeg (Ubuntu):
assignee: nobody → Reinhard Tartler (siretart)
status: Triaged → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ffmpeg - 4:0.5+svn20090706-2ubuntu2

---------------
ffmpeg (4:0.5+svn20090706-2ubuntu2) karmic; urgency=low

  [ Reinhard Tartler ]
  * Make arguments of av_set_pts_info() unsigned.
  * update debian/changelog
  * use patch for issue1245 from git.ffmpeg.org
  * Support constant-quant encoding for libtheora, LP: #356322
  * increase swscale compile time width (VOF/VOFW), LP: #443264

  [ Loïc Minier ]
  * Update config for karmic's armel toolchain.
  * Enable neon flavour; LP: #383240.
  * Update NEON confflags to assume v7 and VFP.
  * Add backported NEON patches from ffmpeg trunk; see debian/patches/neon/.
  * Pass proper --cpu and --extra-flags on armel.
  * Pass -fPIC -DPIC to neon pass.

 -- Loic Minier <email address hidden> Tue, 13 Oct 2009 23:56:04 +0200

Changed in ffmpeg (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Paul Gevers (paul-climbing) wrote :

Closing this old bug manually, as according to my comment #7 the bug upstream was closed and the upstream link does not work anymore.

Changed in ffmpeg:
importance: Unknown → Undecided
status: Incomplete → New
status: New → Fix Released
Revision history for this message
alvgarci (alvaro-garcia-gonzalo) wrote :

Hi:

Same issue in FFMPEG on MacOS 10.7.3.

Any solution for that?

Thanks

Revision history for this message
Paul Gevers (paul-climbing) wrote :

@alvgarci,

The bug is fixed in both Ubuntu and in upstream ffmpeg/libav. So you will have to ask you distribution for the fix. This is definitely the wrong place, although there might be useful information for the developers of your distribution.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.