Opened 10 years ago

Closed 10 years ago

#3346 closed enhancement (fixed)

WAVE files unplayable if inturrupted during recording process

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

Description

Summary of the bug:
How to reproduce:

% ffmpeg -i input ... output
ffmpeg version
built on ...

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Attachments (1)

ATTACH.txt (415 bytes ) - added by gmvoeth 10 years ago.
Win7x64 Batch Commands in use when problem shows

Download all attachments as: .zip

Change History (6)

by gmvoeth, 10 years ago

Attachment: ATTACH.txt added

Win7x64 Batch Commands in use when problem shows

comment:1 by Carl Eugen Hoyos, 10 years ago

Component: FFmpegundetermined
Keywords: wav added; wave files audio recording removed

Please provide your failing command line (no script) including the complete, uncut console output and please explain in what situation you get a broken output file.

comment:2 by gmvoeth, 10 years ago

While Running the WAVE command if a power interruption occurs
OR I close the batch command windows before completion of the
recording, the wave file will be unplayable and must be deleted
loosing all data. I am aware that good data up to the loss of power
is still present within the file, but, the file will not open or play
most probably because a proper header was not written to the
prematurely closed file. This can most likely be fixed by opening
the wave file entirely and writing the header prior to writing the
data to the file. You already know everything you need to know
to write a good header. The file type and -t command and sample rate and bit rate sets the ultimate file size of any pcm uncompressed format and can be written right away.
However, not all compiler programs are able to open empty files on a disk.
The fix for this problem requires the opening of an empty file with whatever data is already on the disk to its final size at closing time, the data being written to be the only data inserted later. COMPLETE HEADER FIRST, DATA LAST, UNCOMPRESSED PCM WAVE FILE. Then, if a power failure occurs the file should be readable even if the data is not right, it will be good up to power failure with garbage at the file end. But still playable. I hope you understand what I am trying to say.

comment:3 by gmvoeth, 10 years ago

Since there is a power loss there will be no recovery of the error, there is no need of error to understand what I am saying. You simply need to open the whole file and write the entire header prior to insertion of data within the previously opened file. However, NOT ALL COMPILER PROGRAMS ARE ABLE TO OPEN AN EMPTY FILE. An empty file allows the reading of previously deleted data on the HDD and is a security issue to some companies providing the compiler. You need a compiler created by programmers not paranoid about the laws.

comment:4 by Carl Eugen Hoyos, 10 years ago

Please provide the ffmpeg command line and the complete, uncut console output until you kill the process to make this a valid ticket.
(The wav header is of course written before the actual audio data is written to the file and killing a ffmpeg process writing a wav file does not invalidate the output file here.)

comment:5 by Carl Eugen Hoyos, 10 years ago

Component: undeterminedavformat
Resolution: fixed
Status: newclosed
Version: unspecifiedgit-master

Should be fixed in c2b0ce70

Note: See TracTickets for help on using tickets.