Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#4543 closed defect (fixed)

Bad WAV output for an mkv file

Reported by: birdie Owned by:
Priority: minor Component: avformat
Version: git-master Keywords: wav
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug: when I try to export six channel audio from an MKV file the resulting file is broken (has a wrong length).

ffmpeg version 2.6.2

How to reproduce:

$ ffmpeg -i *mkv -vn output6ch.wav

Input #0, matroska,webm, from 'testfile.mkv':
  Duration: 02:13:34.08, start: 0.000000, bitrate: 10924 kb/s

    Stream #0:0(eng): Video: h264 (High), yuv420p, 1920x800, SAR 1:1 DAR 12:5, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s (default)
    Stream #0:2(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s
    Stream #0:3(dut): Subtitle: subrip (default)
    Metadata:
      title           : QoQ-Team
Output #0, wav, to 'output6ch.wav':
  Metadata:
    ISFT            : Lavf56.25.101


Stream mapping:
  Stream #0:1 -> #0:0 (ac3 (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
size= 4507920kB time=02:13:34.08 bitrate=4608.0kbits/s
video:0kB audio:4507920kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000002%

$ ffprobe *wav

Input #0, wav, from 'output6ch.wav':
  Metadata:
    encoder         : Lavf56.25.101
  Duration: 00:09:17.54, bitrate: 66235 kb/s
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, 5.1(side), s16, 4608 kb/s

$ ls -la *wav
-rw-rw-r-- 1 user user 4616110182 May  8 15:46 output6ch.wav

As you can see the WAV file is heavily truncated.

Change History (7)

comment:1 Changed 4 years ago by cehoyos

  • Priority changed from important to normal

Unfortunately, this ticket is useless as-is.

To make this a valid ticket, please test current FFmpeg git head and provide your actual FFmpeg command line that produces the broken output together with the complete, uncut console output.
The input sample may be needed, the ftp server has no size limit.

Last edited 4 years ago by cehoyos (previous) (diff)

comment:2 follow-up: Changed 4 years ago by birdie

I will retest this issue when you create a new official GIT snapshot, like, e.g. ffmpeg 2.6.3.

No such problems exists with FLAC output.

The command line that produces the broken output was actually given.

comment:3 in reply to: ↑ 2 ; follow-up: Changed 4 years ago by cehoyos

Replying to birdie:

I will retest this issue when you create a new official GIT snapshot, like, e.g. ffmpeg 2.6.3.

You misunderstand:
Bug reports can only be made against current git head, please see https://ffmpeg.org/bugreports.html

Exceptions are regressions and security issues but you claimed neither of them.

No such problems exists with FLAC output.

Of course not, see http://en.wikipedia.org/wiki/WAV#Limitations

The command line that produces the broken output was actually given.

To make this a valid ticket, please provide your actual command line with an actual file name together with the complete, uncut console output.

comment:4 in reply to: ↑ 3 Changed 4 years ago by birdie

Replying to cehoyos:

No such problems exists with FLAC output.

Of course not, see http://en.wikipedia.org/wiki/WAV#Limitations

Which makes this bug report invalid, so I hope future ffmpeg versions will refuse to generate WAV files larger than 232 bytes since it looks like ffmpeg produces invalid headers for such big files.

comment:5 Changed 4 years ago by jamrial

For WAV files this big, you need to mux it using the "-rf64 auto" or "-rf64 always" option.
Just keep in mind it will not be a standard WAV file and some players and applications may not be able to read it.

See https://en.wikipedia.org/wiki/RF64

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

  • Component changed from undetermined to avformat
  • Keywords wav added
  • Priority changed from normal to minor
  • Reproduced by developer set
  • Resolution set to fixed
  • Status changed from new to closed

Commit 2608f11863918c7d82c3cb8928f6224d67e83bf1 implements an error message if too large wav files are written and stops FFmpeg from writing a smaller file size in that case. Commit 2acc06565321fde44faf407679c9c211aacaca08 allows to read such invalid large wav files with FFmpeg (if no incorrect small filesize was written), thank you for the report!

For future tickets, please remember to test current FFmpeg git head and to provide the command line that allows to reproduce the issue together with the complete, uncut console output.

comment:7 in reply to: ↑ 6 Changed 4 years ago by birdie

Thank you for the fix!

Note: See TracTickets for help on using tickets.