[libav-bugs] [Bug 321] New: Converting MJPG to mp4 with avconv leads to bad quality video

bugzilla-daemon at aruru.libav.org bugzilla-daemon at aruru.libav.org
Thu Jun 21 11:06:48 CEST 2012


https://bugzilla.libav.org/show_bug.cgi?id=321

           Summary: Converting MJPG to mp4 with avconv leads to bad
                    quality video
           Product: Libav
           Version: 0.8
          Platform: X86
        OS/Version: Linux
            Status: NEW
          Severity: critical
          Priority: Normal
         Component: general
        AssignedTo: bugzilla at libav.org
        ReportedBy: divers at batmat.net


1. Until recently, I had shell script with an avconv command line that would
convert the videos produced by my camera (Canon Powershot A650 IS) without any
issue using avconv. 
2. After migrating to KUbuntu 12.04, this command started failing. 
3. I finally found a different avconv, but this gives a poor quality video
where the previous avconv command would give an absolutely perfect one.

I'm going to attach a sample original AVI file, and the bad resulting one.

---

Details:
Previously working command, giving a perfect result:
$ avconv -i mjpeg-video.avi -ar 44100 output.mp4

After migrating to KUbuntu 12.04, this command started failing with the
following output:
---
avconv version 0.8.3-4:0.8.3-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the
Libav developers
  built on Jun 12 2012 16:37:58 with gcc 4.6.3
Input #0, avi, from 'example-mjpeg-canon-PowerShot-A650-IS.AVI':
  Metadata:
    creation_time   : 2012-06-20 21:51:27
    encoder         : CanonMVI06
  Duration: 00:00:06.13, start: 0.000000, bitrate: 10652 kb/s
    Stream #0.0: Video: mjpeg, yuvj422p, 640x480, 30 tbr, 30 tbn, 30 tbc
    Stream #0.1: Audio: pcm_u8, 11024 Hz, 1 channels, u8, 88 kb/s
Incompatible pixel format 'yuvj422p' for codec 'mpeg4', auto-selecting format
'yuv420p'
[buffer @ 0x90768a0] w:640 h:480 pixfmt:yuvj422p
[avsink @ 0x9076a20] auto-inserting filter 'auto-inserted scaler 0' between the
filter 'src' and the filter 'out'
[scale @ 0x906e6c0] w:640 h:480 fmt:yuvj422p -> w:640 h:480 fmt:yuv420p
flags:0x4
Incompatible sample format 'u8' for codec 'aac', auto-selecting format 's16'
[mpeg4 @ 0x90764a0] timebase 33333/1000000 not supported by MPEG 4 standard,
the maximum admitted value for the timebase denominator is 65535
Output #0, mp4, to 'output.mp4':
  Metadata:
    creation_time   : 2012-06-20 21:51:27
    encoder         : CanonMVI06
    Stream #0.0: Video: mpeg4, yuv420p, 640x480, q=2-31, 200 kb/s, 90k tbn, 30
tbc
    Stream #0.1: Audio: [0][0][0][0] / 0x0000, 44100 Hz, 1 channels, s16, 200
kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg -> mpeg4)
  Stream #0:1 -> #0:1 (pcm_u8 -> aac)
Error while opening encoder for output stream #0:0 - maybe incorrect parameters
such as bit_rate, rate, width or height
--

So, after re-reading the documentation, I finally managed to find a new working
avconv command, but now the resulting video quality is bad. It contains visible
squares where the previous command (at the beginning of this report) would just
give a perfect mp4 one:
$ avconv -i example-mjpeg-canon-PowerShot-A650-IS.AVI -ar 44100 -r 30 -strict
experimental output.mp4

The corresponding output is then:
avconv version 0.8.3-4:0.8.3-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the
Libav developers
  built on Jun 12 2012 16:37:58 with gcc 4.6.3
Input #0, avi, from 'example-mjpeg-canon-PowerShot-A650-IS.AVI':
  Metadata:
    creation_time   : 2012-06-20 21:51:27
    encoder         : CanonMVI06
  Duration: 00:00:06.13, start: 0.000000, bitrate: 10652 kb/s
    Stream #0.0: Video: mjpeg, yuvj422p, 640x480, 30 tbr, 30 tbn, 30 tbc
    Stream #0.1: Audio: pcm_u8, 11024 Hz, 1 channels, u8, 88 kb/s
File 'output.mp4' already exists. Overwrite ? [y/N] y
Incompatible pixel format 'yuvj422p' for codec 'mpeg4', auto-selecting format
'yuv420p'
[buffer @ 0x84fa620] w:640 h:480 pixfmt:yuvj422p
[avsink @ 0x84f4440] auto-inserting filter 'auto-inserted scaler 0' between the
filter 'src' and the filter 'out'
[scale @ 0x84f48a0] w:640 h:480 fmt:yuvj422p -> w:640 h:480 fmt:yuv420p
flags:0x4
Incompatible sample format 'u8' for codec 'aac', auto-selecting format 's16'
Output #0, mp4, to 'output.mp4':
  Metadata:
    creation_time   : 2012-06-20 21:51:27
    encoder         : Lavf53.21.0
    Stream #0.0: Video: mpeg4, yuv420p, 640x480, q=2-31, 200 kb/s, 30 tbn, 30
tbc
    Stream #0.1: Audio: aac, 44100 Hz, 1 channels, s16, 200 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg -> mpeg4)
  Stream #0:1 -> #0:1 (pcm_u8 -> aac)
Press ctrl-c to stop encoding
Using s16 intermediate sample format for resampling
frame=  184 fps=159 q=9.7 Lsize=     353kB time=6.13 bitrate= 471.7kbits/s    
video:245kB audio:103kB global headers:0kB muxing overhead 1.370792%

But the resulting video has poor quality, see above.

-- 
Configure bugmail: https://bugzilla.libav.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.


More information about the libav-bugs mailing list