Opened 12 years ago

Closed 12 years ago

#1434 closed defect (fixed)

Remuxing an H.264 video from MP4 to AVI increases the size by more than 10

Reported by: Clément Bœsch Owned by:
Priority: important Component: undetermined
Version: git-master Keywords: mov avi remux regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Command line:
./ffmpeg -report -i remux-me-to-avi.mp4 -an -c copy -y out.avi
ffmpeg version N-41456-g94632db Copyright (c) 2000-2012 the FFmpeg developers
  built on Jun  9 2012 20:46:46 with gcc 4.7.0 20120505 (prerelease)
  configuration: --enable-gpl --enable-fontconfig --enable-libfreetype --enable-libmp3lame --enable-libvorbis --enable-libxvid --enable-libx264 --enable-libvpx --enable-libtheora --enable-x11grab --enable-libopenjpeg --enable-libass --enable-libmodplug --cc='ccache colorgcc' --samples=/home/ubitux/fate-samples --prefix=/tmp/ffinstall
  libavutil      51. 56.100 / 51. 56.100
  libavcodec     54. 25.100 / 54. 25.100
  libavformat    54.  6.101 / 54.  6.101
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     2. 78.101 /  2. 78.101
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x33fcd20] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x33fcd20] ISO: File Type Major Brand: isom
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x33fcd20] File position before avformat_find_stream_info() is 4023420
[h264 @ 0x34034e0] no picture 
[h264 @ 0x34034e0] no picture 
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x33fcd20] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x33fcd20] File position after avformat_find_stream_info() is 258968
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'remux-me-to-avi.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2012-06-09 13:19:34
    encoder         : Lavf54.6.100
  Duration: 00:00:20.16, start: 0.000000, bitrate: 1596 kb/s
    Stream #0:0(und), 21, 1/90000: Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 708x566 [SAR 64:45 DAR 7552:4245], 1432 kb/s, 24.80 fps, 25 tbr, 90k tbn, 180k tbc
    Metadata:
      creation_time   : 2012-06-09 13:19:34
      handler_name    : VideoHandler
    Stream #0:1(und), 38, 1/48000: Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 159 kb/s
    Metadata:
      creation_time   : 2012-06-09 13:19:34
      handler_name    : SoundHandler
Output #0, avi, to 'out.avi':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2012-06-09 13:19:34
    ISFT            : Lavf54.6.101
    Stream #0:0(und), 0, 1/90000: Video: h264 (avc1 / 0x31637661), yuv420p, 708x566 [SAR 64:45 DAR 7552:4245], q=2-31, 1432 kb/s, 24.80 fps, 90k tbn, 90k tbc
    Metadata:
      creation_time   : 2012-06-09 13:19:34
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=  500 fps=212 q=-1.0 Lsize=   45633kB time=00:00:19.96 bitrate=18728.8kbits/s    
video:3524kB audio:0kB global headers:0kB muxing overhead 1194.850083%
% ls -l out.avi remux-me-to-avi.mp4
-rw-r--r-- 1 ubitux ubitux  45M Jun  9 21:01 out.avi
-rw-r--r-- 1 ubitux ubitux 3.9M Jun  9 20:47 remux-me-to-avi.mp4

Change History (7)

comment:1 by Clément Bœsch, 12 years ago

The input file is available here: http://ompldr.org/iZTdpbg

comment:2 by Carl Eugen Hoyos, 12 years ago

Keywords: mov regression added; mp4 size removed
Priority: normalimportant
Reproduced by developer: set
Status: newopen
Version: unspecifiedgit-master

At least for the following command this is a regression (the original command line produces a file that does not play properly also with an old version of FFmpeg, this command line also produces a file with increased size with current git head, but works fine with an old version):

$ ffmpeg -i out.mp4 -vcodec copy -acodec mp2 out.avi
ffmpeg version N-41413-gb35d38b Copyright (c) 2000-2012 the FFmpeg developers
  built on Jun  8 2012 19:40:05 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
  libavutil      51. 56.100 / 51. 56.100
  libavcodec     54. 25.100 / 54. 25.100
  libavformat    54.  6.101 / 54.  6.101
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     2. 78.101 /  2. 78.101
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2012-06-09 13:19:34
    encoder         : Lavf54.6.100
  Duration: 00:00:20.16, start: 0.000000, bitrate: 1596 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 708x566 [SAR 64:45 DAR 7552:4245], 1432 kb/s, 24.80 fps, 25 tbr, 90k tbn, 180k tbc
    Metadata:
      creation_time   : 2012-06-09 13:19:34
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 159 kb/s
    Metadata:
      creation_time   : 2012-06-09 13:19:34
      handler_name    : SoundHandler
Output #0, avi, to 'out.avi':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2012-06-09 13:19:34
    ISFT            : Lavf54.6.101
    Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p, 708x566 [SAR 64:45 DAR 7552:4245], q=2-31, 1432 kb/s, 24.80 fps, 90k tbn, 90k tbc
    Metadata:
      creation_time   : 2012-06-09 13:19:34
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo, s16, 128 kb/s
    Metadata:
      creation_time   : 2012-06-09 13:19:34
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (aac -> mp2)
Press [q] to stop, [?] for help
frame=  500 fps=113 q=-1.0 Lsize=   45970kB time=00:00:19.96 bitrate=18866.9kbits/s
video:3524kB audio:313kB global headers:0kB muxing overhead 1098.075719%

in reply to:  2 comment:3 by Michael Niedermayer, 12 years ago

Replying to cehoyos:

At least for the following command this is a regression (the original command line produces a file that does not play properly also with an old version of FFmpeg, this command line also produces a file with increased size with current git head, but works fine with an old version):

please elaborate what does work better with which old version

comment:4 by Michael Niedermayer, 12 years ago

You can override the frame rate with -r 25 after my next push which will make the file normally sized

comment:5 by Carl Eugen Hoyos, 12 years ago

out05.avi plays fine MPlayer, ffplay and vlc, outgit.avi seems broken for all players.

$ ffmpeg -i out.mp4 -vcodec copy -acodec mp2 out05.avi
FFmpeg version 0.5, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --shlibdir=/usr/lib --prefix=/usr --mandir=/usr/share/man --libdir=/usr/lib --enable-shared --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libfaad --enable-libfaac --enable-libxvid --enable-swscale --enable-postproc --enable-gpl --enable-vhook --enable-x11grab --enable-libschroedinger --enable-libdirac --enable-libgsm --enable-libx264 --enable-libamr-nb --enable-libamr-wb --enable-libdc1394 --enable-nonfree --enable-pthreads --enable-vdpau
  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
  libswscale     0. 7. 1 /  0. 7. 1
  libpostproc   51. 2. 0 / 51. 2. 0
  built on May 14 2009 12:56:28, gcc: 4.2.1 (SUSE Linux)

Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1) -> 25.00 (25/1)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mp4':
  Duration: 00:00:20.16, start: 0.000000, bitrate: 1596 kb/s
    Stream #0.0(und): Video: h264, yuv420p, 708x566, PAR 64:45 DAR 7552:4245, 25 tbr, 25 tbn, 50 tbc
    Stream #0.1(und): Audio: aac, 48000 Hz, stereo, s16
Output #0, avi, to 'out05.avi':
    Stream #0.0(und): Video: libx264, yuv420p, 708x566 [PAR 64:45 DAR 7552:4245], q=2-31, 90k tbn, 25 tbc
    Stream #0.1(und): Audio: mp2, 48000 Hz, stereo, s16, 64 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Press [q] to stop encoding
frame=  500 fps=  0 q=-1.0 Lsize=    3722kB time=19.97 bitrate=1526.8kbits/s
video:3524kB audio:156kB global headers:0kB muxing overhead 1.122238%
$ ffmpeg -i out.mp4 -vcodec copy -acodec mp2 outgit.avi
ffmpeg version N-41509-g20e46aa Copyright (c) 2000-2012 the FFmpeg developers
  built on Jun 11 2012 09:15: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
  libavutil      51. 57.100 / 51. 57.100
  libavcodec     54. 25.100 / 54. 25.100
  libavformat    54.  6.101 / 54.  6.101
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     2. 78.101 /  2. 78.101
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2012-06-09 13:19:34
    encoder         : Lavf54.6.100
  Duration: 00:00:20.16, start: 0.000000, bitrate: 1596 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 708x566 [SAR 64:45 DAR 7552:4245], 1432 kb/s, 24.80 fps, 25 tbr, 90k tbn, 180k tbc
    Metadata:
      creation_time   : 2012-06-09 13:19:34
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 159 kb/s
    Metadata:
      creation_time   : 2012-06-09 13:19:34
      handler_name    : SoundHandler
Output #0, avi, to 'outgit.avi':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2012-06-09 13:19:34
    ISFT            : Lavf54.6.101
    Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p, 708x566 [SAR 64:45 DAR 7552:4245], q=2-31, 1432 kb/s, 24.80 fps, 90k tbn, 90k tbc
    Metadata:
      creation_time   : 2012-06-09 13:19:34
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo, s16, 128 kb/s
    Metadata:
      creation_time   : 2012-06-09 13:19:34
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (aac -> mp2)
Press [q] to stop, [?] for help
frame=  500 fps= 98 q=-1.0 Lsize=   45970kB time=00:00:19.96 bitrate=18866.9kbits/s
video:3524kB audio:313kB global headers:0kB muxing overhead 1098.075719%

comment:6 by Carl Eugen Hoyos, 12 years ago

The size increase is a regression since r19148 / bbe46bc

The playback regression is only reproducible with mplayer -demuxer avi, mplayer -demuxer lavf plays the large file fine.

comment:7 by Michael Niedermayer, 12 years ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.