Opened 13 years ago

Closed 12 years ago

#1263 closed defect (needs_more_info)

ffmpeg keeps the output file in memory and only writes it to disk after [q]uitting

Reported by: pmts Owned by:
Priority: normal Component: ffmpeg
Version: git-master Keywords: memory dts mkv
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Tested with current git and 0.10.2.

This seems to happen with one particular input file. I'm trying to remux that file using ffmpeg while transcoding a dts track into ac3. This transcoding seems to trigger the bug. While encoding ffmpeg started allocating huge amounts of memory, on the order of 100MB/s. At first I thought it's a memory leak, bu then I noticed it's keeping the output file in memory and only writes it to disk after I tell it to stop.

My command line:

ffmpeg -i The.Good.the.Bad.and.the.Ugly.1966.720p.BluRay.HQF.mkv -vcodec copy -acodec ac3 -ab 448k -map 0:v -map 0:2 -map 0:6 -map 0:7 -map 0:8 -map 0:9 -scodec copy /mnt/auto/megamagazyn/filmy/The.Good.the.Bad.and.the.Ugly.1966.720p.BluRay.HQF.mkv

0.10.2 didn't print any errors/warnings, but current git floods the screen with the following:

DTS 15936, next:15984666 st:2 invalid dropping
PTS 15936, next:15984666 invalid dropping st:2
DTS 15946, next:15995332 st:2 invalid dropping
PTS 15946, next:15995332 invalid dropping st:2
DTS 15956, next:16005998 st:2 invalid dropping
PTS 15956, next:16005998 invalid dropping st:2
DTS 15966, next:16016664 st:2 invalid dropping
PTS 15966, next:16016664 invalid dropping st:2
DTS 15976, next:16027330 st:2 invalid dropping
PTS 15976, next:16027330 invalid dropping st:2
DTS 15986, next:16037996 st:2 invalid dropping
PTS 15986, next:16037996 invalid dropping st:2
DTS 15996, next:16048662 st:2 invalid dropping
PTS 15996, next:16048662 invalid dropping st:2
DTS 16006, next:16059328 st:2 invalid dropping
PTS 16006, next:16059328 invalid dropping st:2
DTS 16021, next:16069994 st:2 invalid dropping
PTS 16021, next:16069994 invalid dropping st:2
DTS 16031, next:16080660 st:2 invalid dropping
PTS 16031, next:16080660 invalid dropping st:2

I'll attach a full verbose log, where I let it run for a couple of seconds and pressed 'q'.

I also noticed, that if I only give it -c copy -map 0, it quits immediately with the following error:

DTS 15936, next:15974000 st:2 invalid dropping
PTS 15936, next:15974000 invalid dropping st:2
[matroska @ 0x111f910] Application provided invalid, non monotonically increasing dts to muxer in stream 2: 15974 >= 15974
av_interleaved_write_frame(): Invalid argument
$ ffmpeg -v 9 -loglevel 99 -i The.Good.the.Bad.and.the.Ugly.1966.720p.BluRay.HQF.mkv 
ffmpeg version N-40215-g46eba43 Copyright (c) 2000-2012 the FFmpeg developers
  built on Apr 29 2012 22:20:13 with gcc 4.6.2
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar --optflags='-O2 -march=native -pipe -ggdb' --extra-cflags='-O2 -march=native -pipe -ggdb' --extra-cxxflags='-O2 -march=native -pipe -ggdb' --disable-static --enable-gpl --enable-version3 --enable-postproc --enable-avfilter --disable-stripping --disable-debug --disable-doc --disable-network --enable-libmp3lame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-libfaac --enable-nonfree --enable-openal --disable-indev=v4l --disable-indev=v4l2 --disable-indev=oss --disable-indev=jack --enable-x11grab --enable-libpulse --disable-outdev=oss --enable-fontconfig --enable-libfreetype --enable-pthreads --enable-libopencore-amrwb --enable-libopencore-amrnb --enable-libbluray --enable-libschroedinger --disable-amd3dnow --disable-amd3dnowext --disabl  libavutil      51. 48.100 / 51. 48.100
  libavcodec     54. 17.101 / 54. 17.101
  libavformat    54.  3.100 / 54.  3.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 72.100 /  2. 72.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 11.100 /  0. 11.100
  libpostproc    52.  0.100 / 52.  0.100
[matroska,webm @ 0x20e1560] Format matroska,webm probed with size=2048 and score=100
st:0 removing common factor 1000000 from timebase
st:1 removing common factor 1000000 from timebase
st:2 removing common factor 1000000 from timebase
st:3 removing common factor 1000000 from timebase
st:4 removing common factor 1000000 from timebase
st:5 removing common factor 1000000 from timebase
st:6 removing common factor 1000000 from timebase
[matroska,webm @ 0x20e1560] File position before avformat_find_stream_info() is 369052
[h264 @ 0x20e57b0] no picture 
[dca @ 0x20e6400] Stream with high frequencies VQ coding
[h264 @ 0x20e57b0] no picture 
[matroska,webm @ 0x20e1560] All info found
[matroska,webm @ 0x20e1560] File position after avformat_find_stream_info() is 853537
Input #0, matroska,webm, from 'The.Good.the.Bad.and.the.Ugly.1966.720p.BluRay.HQF.mkv':
  Metadata:
    title           : HQ-Films
    creation_time   : 2009-04-10 09:35:30
  Duration: 02:58:42.17, start: 0.000000, bitrate: 6743 kb/s
    Stream #0:0(eng), 3, 1/1000: Video: h264 (High), yuv420p, 1280x544, 417083/20000000, SAR 1:1 DAR 40:17, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Stream #0:1(rus), 8, 1/1000: Audio: ac3, 48000 Hz, 5.1(side), s16, 384 kb/s (default)
    Metadata:
      title           : Многоголосый
    Stream #0:2(eng), 8, 1/1000: Audio: dts (DTS), 48000 Hz, 5.1(side), s16, 1536 kb/s
    Metadata:
      title           : Main Audio
    Stream #0:3(eng), 8, 1/1000: Audio: vorbis, 48000 Hz, stereo, s16
    Metadata:
      title           : Commentary Track 1
    Stream #0:4(eng), 8, 1/1000: Audio: vorbis, 48000 Hz, stereo, s16
    Metadata:
      title           : Commentary Track 2
    Stream #0:5(rus), 0, 1/1000: Subtitle: text
    Stream #0:6(eng), 0, 1/1000: Subtitle: ssa
    Stream #0:7, 0, 1/90000: Attachment: ttf
    Metadata:
      filename        : CronosPro-Bold.ttf
      mimetype        : application/x-truetype-font
    Stream #0:8, 0, 1/90000: Attachment: ttf
    Metadata:
      filename        : CronosPro-Semibold.ttf
      mimetype        : application/x-truetype-font
    Stream #0:9, 0, 1/90000: Attachment: ttf
    Metadata:
      filename        : CronosPro-SemiboldIt.ttf
      mimetype        : application/x-truetype-font
At least one output file must be specified

The funniest part? The (partial) output file plays perfectly fine, at least in mplayer2.

Attachments (2)

ffmpeg-20120429-225641.log.bz2 (788.7 KB ) - added by pmts 13 years ago.
full log
sample.mkv (2.4 MB ) - added by pmts 13 years ago.
sample file

Change History (7)

by pmts, 13 years ago

full log

comment:1 by Carl Eugen Hoyos, 13 years ago

Please provide a sample.

by pmts, 13 years ago

Attachment: sample.mkv added

sample file

comment:2 by Michael Niedermayer, 12 years ago

The sample contains fewer streams than are referenced in the given command line.
Please provide a sample file and a command line that match each other and with which the issue can be reproduced.
As long as we cannot reproduce the issue, we are not able to investigate or fix it.

comment:3 by pmts, 12 years ago

The sample was made from a file with which I could reproduce the problem. Just use -vcodec copy -acodec ac3 -ab 448k -map 0:0 -map 0:1

comment:4 by Carl Eugen Hoyos, 12 years ago

Please provide command line together with complete, uncut console output for the sample you attached.

comment:5 by Carl Eugen Hoyos, 12 years ago

Resolution: needs_more_info
Status: newclosed

I don't think the attached sample is long enough to reproduce an issue, please reopen the ticket if you can provide a longer sample (see https://ffmpeg.org/bugreports.html - there is no hard limit on the filesize).

Note: See TracTickets for help on using tickets.