bugGnash - The GNU Flash player - Bugs: bug #45887, `gnash --audio-dump` produces...

 
 

bug #45887: `gnash --audio-dump` produces corrupted WAV file

Submitter:  Nutchanon Wetchasit <nachanon>
Submitted:  Sun 06 Sep 2015 09:37:00 AM UTC
   
 
Category:  None Severity:  3 - Normal
Release:  master Status:  None
Privacy:  Public Assigned to:  strk
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 07 Sep 2015 07:30:17 PM UTC, comment #5: 

Patches applied, thanks !

Sandro Santilli <strk>
Group Member
Mon 07 Sep 2015 11:19:10 AM UTC, comment #4: 

Patches included: see patch #8734.

After applied patch 1-2, output dump file could now be opened properly
by Audacity, SoX, and Sound Recorder.

Gnash: 0.8.11dev (patched against git dc51f53 28-Aug-2015)
Audacity: 2.0.1-1 (debian)
SoX: 14.4.0-3 (debian)
System: Debian GNU/Linux 7.0 Wheezy i386

Sound Recorder: sndrec32 5.1.2600.5512
System: Microsoft Windows XP SP3

Nutchanon Wetchasit <nachanon>
Mon 07 Sep 2015 07:02:29 AM UTC, comment #3: 

After I looked around `libsound/WAVWriter.cpp`, I found following problems:


Other minor issues found are:


Gnash: 0.8.11dev (git dc51f53 28-Aug-2015)
System: Debian GNU/Linux 7.0 Wheezy i386

Nutchanon Wetchasit <nachanon>
Sun 06 Sep 2015 11:27:41 AM UTC, comment #2: 

Looking at the `chime_gnash0.8.11dev-dc51f53.wav` under hex editor reveals following RIFF structure:
(@nnn means offset from file's beginning, numbers are in decimal unless prefixed with `0x`)

RIFF "WAVE"    (chunk@0, payload list@12, payload size 40)
 \
  +- fmt       (chunk@12, payload@20, payload size 16)
  |
  +- data      (chunk@36, payload@44, payload size 0)
  |
  +- \0\0\0\0 *(chunk@44, payload@52, payload size 0xFFFFFFFF)
      .
     (Audio data goes here...)


  • Last chunk is invalid (invalid name, and chunk size exceeded main RIFF chunk).


This shows two problems:

1. Gnash pre-filled `data` chunk size as `0` and filled
`RIFF` chunk's size accordingly, before writing out the audio data.
But when it is about to terminate, it didn't come back to update
the corresponding size fields of `data` and `RIFF` chunk.

2. Gnash put an invalid chunk in the output file. (Not sure if this is
a placeholder for audio data or something)

So when other programs tried to read the dump file, it either interpret
that this is an empty WAV file (0 byte in `data` chunk), or this is a
corrupted WAVE file (due to an invalid chunk of mystery, or garbage that
followed the RIFF chunk).

Side note: following is minimal RIFF structure of a valid empty WAVE file

RIFF "WAVE"    (chunk@0, payload list@12, payload size 32)
 \
  +- fmt       (chunk@12, payload@20, payload size 16)
  |
  +- data      (chunk@36, payload@44, payload size 0)


Nutchanon Wetchasit <nachanon>
Sun 06 Sep 2015 09:46:26 AM UTC, comment #1: 

The corrupted dump file could be fixed by passing it through FFmpeg/AVconv:

ffmpeg -i chime_gnash0.8.11dev-dc51f53.wav -acodec copy chime_gnash0.8.11dev-dc51f53.fixed.wav


The fixed file would be read properly by Audacity.

For the issue itself, I suspect that Gnash initially write RIFF WAVE header
with data length 0 before starting to dump audio but "forgot" to come back
and change the corresponding headers to the real audio length
when the dumping ended.

libAV: libav-tools 6:0.8.10-1 (debian)
Audacity: audacity 2.0.1-1 (debian)
System: Debian GNU/Linux 7.0 Wheezy i386

Nutchanon Wetchasit <nachanon>
Sun 06 Sep 2015 09:37:00 AM UTC, original submission:  

This is a spin-off from bug #45722 (screeching PCM sound).

When I was trying to capture audio dumps from bug #45722's test files using
`gnash --audio-dump` option, I found that the audio dumping process
worked reasonably and resulting WAV file is playable with MPlayer
and VLC.

But when I tried to load the WAV file into Audacity to check the waveform,
it shown up as an empty (0 sec) file, same goes with SoX
and Windows Sound Recorder 5.1. Other programs (e.g. Nero WaveEditor 3.5)
also complained that the file is corrupted and refused to open it.


I have created a simple Flash file (using MTASC, SWFmill and LAME) that
tries to play a simple 6-sec 44100 Hz Mono MP3 sound of Westminster chimes.
Then dumped the audio output using `gnash -1 -r 2 --audio-dump` to demonstrate
the issue.

Test Flash file, code, sound and build script are attached as `chime.zip`.
Resulting WAV file is attached as `chime_gnash0.8.11dev-dc51f53.wav.gz`.
Log output (verbosity 2 + action error log) is attached as `chime_gnash0.8.11dev-dc51f53.log`.


Gnash: 0.8.11dev (git dc51f53 28-Aug-2015, FFmpeg/libAV media backend)
SDL: libsdl1.2debian 1.2.15-5 (debian)
libAV: libavcodec53 6:0.8.17-1 (debian), libavformat53 6:0.8.17-1 (debian), libavutil51 6:0.8.17-1 (debian)
CSound: libcsound64-5.2 1:5.17.11~dfsg-3 (debian)
System: Debian GNU/Linux 7.0 Wheezy i386

Nutchanon Wetchasit <nachanon>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #34819:  chime_gnash0.8.11dev-dc51f53.wav.gz added by nachanon (805KiB - application/x-gzip - Audio dump file and logs from Gnash git dc51f53)
file #34820:  chime_gnash0.8.11dev-dc51f53.log added by nachanon (2KiB - text/x-log - Audio dump file and logs from Gnash git dc51f53)
file #34818:  chime.zip added by nachanon (393KiB - application/zip - Test Flash file, source code, sound and build script)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by strk (Posted a comment)
  • -email is unavailable- added by nachanon (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-09-07 strk Assigned toNone strk
        Open/ClosedOpen Closed
    2015-09-06 nachanon Attached File- Added chime_gnash0.8.11dev-dc51f53.wav.gz, #34819
        Attached File- Added chime_gnash0.8.11dev-dc51f53.log, #34820
    2015-09-06 nachanon Attached File- Added chime.zip, #34818

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code