Opened 5 years ago

Closed 4 years ago

#4042 closed defect (fixed)

Broken console output when transcoding (broken) MEncoder files

Reported by: f_rush Owned by:
Priority: minor Component: avformat
Version: git-master Keywords: avi mp2 regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:
ffmpeg is not able to convert mp2 audio track on huge files ( 60-80G ).
works on 2.4.2, but also was successfully reproduced on 1.0.10.

How to reproduce:

% ffmpeg -i video2.mpg -t 100 -c:a libfaac -map 0:1 output.m4a
ffmpeg version 2.4.2 Copyright (c) 2000-2014 the FFmpeg developers
  built on Oct  5 2014 09:31:05 with gcc 4.9.1 (Debian 4.9.1-16)
  configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-avresample --disable-htmlpages --disable-podpages --enable-libiec61883 --enable-libfdk-aac --enable-vaapi --enable-libx265 --enable-libdc1394 --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu
  libavutil      54.  7.100 / 54.  7.100
  libavcodec     56.  1.100 / 56.  1.100
  libavformat    56.  4.101 / 56.  4.101
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  1.100 /  5.  1.100
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100

After execution I get about 5-6kB audio file with no sound.

Initially I tried to convert video file from raw to x264, video conversion finishes without any issues, though there is no sounds, even audio track in file is present. Then I tried to convert just audio without video and it is the same. It doesn't matter to which audio format I want to convert. Even simple copy doesn't work.

Here is full output for copy:

 $ ffmpeg -i video2.mpg -t 100 -c:a copy -map 0:1 output.aac
ffmpeg version 2.4.2 Copyright (c) 2000-2014 the FFmpeg developers
  built on Oct  5 2014 09:31:05 with gcc 4.9.1 (Debian 4.9.1-16)
  configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-avresample --disable-htmlpages --disable-podpages --enable-libiec61883 --enable-libfdk-aac --enable-vaapi --enable-libx265 --enable-libdc1394 --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu
  libavutil      54.  7.100 / 54.  7.100
  libavcodec     56.  1.100 / 56.  1.100
  libavformat    56.  4.101 / 56.  4.101
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  1.100 /  5.  1.100
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100
[avi @ 0xfeffa0] non-interleaved AVI
Input #0, avi, from 'video2.mpg':
  Metadata:
    encoder         : MEncoder SVN-r37289
  Duration: 01:37:08.64, start: 0.000000, bitrate: 123100 kb/s
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 122869 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
    Stream #0:1: Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo, s16p, 224 kb/s
File 'output.aac' already exists. Overwrite ? [y/N] y
Output #0, adts, to 'output.aac':
  Metadata:
    encoder         : Lavf56.4.101
    Stream #0:0: Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo, 224 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
Press [q] to stop, [?] for help
size=       5kB time=00:01:36.79 bitrate=   0.4kbits/s    
video:0kB audio:5kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%

Source file can be played with mplayer without any issues. I tried to get small file (about 150M) with same codecs (the file is produced with mencoder and dump the stream from /dev/video0 ) and it can convert it fine. Looks like only big files are affected. So it's impossible to attach 80G video to the ticket.

Attachments (1)

mencoder.avi (1.7 MB) - added by cehoyos 5 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 5 years ago by f_rush

  • Priority changed from important to normal

comment:2 Changed 5 years ago by cehoyos

  • Component changed from ffmpeg to undetermined

Is the issue not reproducible with current FFmpeg git head?

Please provide the MEncoder command line that produces your input file and please provide the complete, uncut console output of ffmpeg -i video2.mpg out.mp2 (and confirm that the output file is not ok) to make this a valid ticket.

comment:3 Changed 5 years ago by f_rush

here is mencoder options:

mencoder tv:// -tv driver=v4l2:device=/dev/video1:alsa:adevice=hw.1:forceaudio:volume=80 -ovc copy -oac lavc -lavcopts vcodec=mpeg2video -vf harddup -o abi.mpg 

here is convert attempt:

 $ ffmpeg -i abi.mpg abi.mp2
ffmpeg version 2.4.2 Copyright (c) 2000-2014 the FFmpeg developers
  built on Oct  5 2014 09:31:05 with gcc 4.9.1 (Debian 4.9.1-16)
  configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-avresample --disable-htmlpages --disable-podpages --enable-libiec61883 --enable-libfdk-aac --enable-vaapi --enable-libx265 --enable-libdc1394 --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu
  libavutil      54.  7.100 / 54.  7.100
  libavcodec     56.  1.100 / 56.  1.100
  libavformat    56.  4.101 / 56.  4.101
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  1.100 /  5.  1.100
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100
[avi @ 0x1d2cfa0] non-interleaved AVI
Input #0, avi, from 'abi.mpg':
  Metadata:
    encoder         : MEncoder SVN-r37289
  Duration: 01:32:15.60, start: 0.000000, bitrate: 123104 kb/s
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 122872 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
    Stream #0:1: Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo, s16p, 224 kb/s
Output #0, mp2, to 'abi.mp2':
  Metadata:
    encoder         : Lavf56.4.101
    Stream #0:0: Audio: mp2, 48000 Hz, stereo, s16, 384 kb/s
    Metadata:
      encoder         : Lavc56.1.100 mp2
Stream mapping:
  Stream #0:1 -> #0:0 (mp2 (native) -> mp2 (native))
Press [q] to stop, [?] for help
size=      37kB time=00:08:36.10 bitrate=   0.6kbits/s    
video:0kB audio:37kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
Received signal 2: terminating.

confirm that result file is incorrect. here is information about output file (conversion process was manually stopped after several minutes, that's why it's much shorter and anyway it should not affect the process itself )

[mp3 @ 0x19f9b20] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from 'abi.mp2':
  Duration: 00:00:00.82, start: 0.000000, bitrate: 372 kb/s
    Stream #0:0: Audio: mp2, 48000 Hz, stereo, s16p, 372 kb/s
At least one output file must be specified
Last edited 5 years ago by f_rush (previous) (diff)

comment:4 follow-up: Changed 5 years ago by cehoyos

If you manually stopped the conversion after eight minutes were transcoded and the output file is eight minutes wrong, what was not correct about the conversion process?

comment:5 in reply to: ↑ 4 Changed 5 years ago by f_rush

as you can see the duration of output file is 00:00:00.82 (check ffmpeg -i abi.mp2 at the end of my previous comment) and not 8 minutes. and that is wrong!

comment:6 Changed 5 years ago by cehoyos

I recorded ~50G with the MEncoder command line you provided and converted the audio of the resulting file with the command line I posted above and the mp2 output file plays fine here.
Could you test again without interrupting the conversion process (it takes considerable time to read a file of this size, so you have to wait) and test playing the resulting mp2 file? Is there really anything wrong with it?
I know that MEncoder is broken for the command line you provided and I know that the console output of FFmpeg is not correct when transcoding these broken MEncoder files but this is not what you reported: Iiuc you reported that the output file that FFmpeg produces for the command line I suggested is broken, this is still unreproducible to me.

comment:7 Changed 5 years ago by f_rush

  • Resolution set to invalid
  • Status changed from new to closed

ok, I see now. the problem is that ffmpeg output calculates incorrect time ranges while conversion is ongoing.
if I'm running the full conversion it works fine and output file is good enough for me.

 $ time ffmpeg -i abi.mpg abi.mp2
ffmpeg version 2.4.2 Copyright (c) 2000-2014 the FFmpeg developers
  built on Oct  5 2014 09:31:05 with gcc 4.9.1 (Debian 4.9.1-16)
  configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-avresample --disable-htmlpages --disable-podpages --enable-libiec61883 --enable-libfdk-aac --enable-vaapi --enable-libx265 --enable-libdc1394 --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu
  libavutil      54.  7.100 / 54.  7.100
  libavcodec     56.  1.100 / 56.  1.100
  libavformat    56.  4.101 / 56.  4.101
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  1.100 /  5.  1.100
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100
[avi @ 0x1390aa0] non-interleaved AVI
Input #0, avi, from 'abi.mpg':
  Metadata:
    encoder         : MEncoder SVN-r37289
  Duration: 01:32:15.60, start: 0.000000, bitrate: 123104 kb/s
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 25 tbr, 25 tbn, 25 tbc
    Stream #0:1: Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo, s16, 224 kb/s
Output #0, mp2, to 'abi.mp2':
  Metadata:
    encoder         : Lavf54.29.104
    Stream #0:0: Audio: mp2, 48000 Hz, stereo, s16, 128 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (mp2 -> mp2)
Press [q] to stop, [?] for help
error parsing debug value40:12.30 bitrate=   0.2kbits/s    
debug=0
size=   86493kB time=1033:18:10.95 bitrate=   0.2kbits/s    
video:0kB audio:86493kB subtitle:0 global headers:0kB muxing overhead 0.000000%

real    26m8.850s
user    2m46.876s
sys     3m36.180s

and outputed file duration also exceeds source file:

Input #0, mp3, from 'abi.mp2':
  Duration: 01:34:06.88, start: 0.000000, bitrate: 125 kb/s
    Stream #0:0: Audio: mp2, 48000 Hz, stereo, s16p, 125 kb/s

You can see 01:34:06.88 while original file was 01:32:15.60.

So I guess I can close ticket as invalid. Thank you for you help cehoyos.

Changed 5 years ago by cehoyos

comment:8 Changed 5 years ago by cehoyos

  • Priority changed from normal to minor
  • Resolution invalid deleted
  • Status changed from closed to reopened
  • Summary changed from ffmpeg is not able to convert mp2 audio to Broken console output when transcoding (broken) MEncoder files
  • Version changed from 2.4.2 to git-master

When transcoding (broken) avi files made with current MEncoder, FFmpeg shows completely wrong time information for the audio track. The attached sample is fifteen seconds long.

$ ffmpeg -i mencoder.avi out.mp2
ffmpeg version N-67022-g69071e8 Copyright (c) 2000-2014 the FFmpeg developers
  built on Oct 19 2014 14:53:44 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      54. 10.100 / 54. 10.100
  libavcodec     56.  8.102 / 56.  8.102
  libavformat    56.  9.101 / 56.  9.101
  libavdevice    56.  1.100 / 56.  1.100
  libavfilter     5.  1.106 /  5.  1.106
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
[avi @ 0x2d77d20] non-interleaved AVI
Input #0, avi, from 'mencoder.avi':
  Metadata:
    encoder         : MEncoder SVN-r37259-4.7
  Duration: 00:00:15.03, start: 0.000000, bitrate: 933 kb/s
    Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 695 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc
    Stream #0:1: Audio: mp2 (P[0][0][0] / 0x0050), 44100 Hz, mono, s16p, 224 kb/s
Output #0, mp2, to 'out.mp2':
  Metadata:
    encoder         : Lavf56.9.101
    Stream #0:0: Audio: mp2, 44100 Hz, mono, s16, 384 kb/s
    Metadata:
      encoder         : Lavc56.8.102 mp2
Stream mapping:
  Stream #0:1 -> #0:0 (mp2 (native) -> mp2 (native))
Press [q] to stop, [?] for help
size=     704kB time=03:02:47.26 bitrate=   0.5kbits/s
video:0kB audio:704kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%

The output file is fifteen seconds long and plays fine.

comment:9 Changed 5 years ago by cehoyos

  • Component changed from undetermined to avcodec
  • Keywords mp2 regression added
  • Reproduced by developer set
  • Status changed from reopened to open

Looks like a regression since 967facb6 / b0f75ba2

comment:10 Changed 4 years ago by cehoyos

  • Component changed from avcodec to avformat
  • Keywords avi added
  • Resolution set to fixed
  • Status changed from open to closed

I believe this was fixed by Gabor Nagy in ae8168074eb1c8230d9c6482102ca08a70a9c4b0 (and 2.6).

Note: See TracTickets for help on using tickets.