[FFmpeg-user] Post problem: export long wav files (incorrect/limited length)

Dave Rice dave at dericed.com
Mon Nov 19 02:53:44 CET 2012


On Nov 18, 2012, at 6:36 PM, Stas Fomin wrote:

> I have problem with export long wav files (>8 hours) from a video.
> 
> Exported files have length only about 2.5 hour (but "good" size).
> 
> <pre>
> ffmpeg.exe -analyzeduration 999999999 -i aud.scenario.avs$lossless.avi  -f wav d2.wav
> ffmpeg version N-46469-gc995644 Copyright (c) 2000-2012 the FFmpeg developers
>  built on Nov  5 2012 17:54:28 with gcc 4.7.2 (GCC)
>  configuration: --enable-gpl --enable-version3 --disable-pthreads --enable-runt
> ime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass -
> -enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enab
> le-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-libo
> pus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheo
> ra --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-li
> bvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --ena
> ble-zlib
>  libavutil      52.  5.100 / 52.  5.100
>  libavcodec     54. 71.100 / 54. 71.100
>  libavformat    54. 36.100 / 54. 36.100
>  libavdevice    54.  3.100 / 54.  3.100
>  libavfilter     3. 21.106 /  3. 21.106
>  libswscale      2.  1.102 /  2.  1.102
>  libswresample   0. 16.100 /  0. 16.100
>  libpostproc    52.  1.100 / 52.  1.100
> [avi @ 022ab5a0] non-interleaved AVI
> Guessed Channel Layout for  Input Stream #0.1 : stereo
> Input #0, avi, from 'aud.scenario.avs$lossless.avi':
>  Metadata:
>    encoder         : Lavf53.2.0
>  Duration: 08:26:37.00, start: 0.000000, bitrate: 2395 kb/s
>    Stream #0:0: Video: h264 (High 4:4:4 Predictive) (H264 / 0x34363248), yuv420
> p, 128x64, 25 fps, 25 tbr, 25 tbn, 50 tbc
>    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16
> , 1536 kb/s
> File 'd2.wav' already exists. Overwrite ? [y/N] y
> Output #0, wav, to 'd2.wav':
>  Metadata:
>    ISFT            : Lavf54.36.100
>    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16
> , 1536 kb/s
> Stream mapping:
>  Stream #0:1 -> #0:0 (pcm_s16le -> pcm_s16le)
> Press [q] to stop, [?] for help
> size= 5699438kB time=08:26:37.00 bitrate=1536.0kbits/s
> video:0kB audio:5699438kB subtitle:0 global headers:0kB muxing overhead 0.000001
> %
> </pre>
> 
> 
> <pre>
> D:\bug-export-wav>ffmpeg -analyzeduration 999999999 -i d2.wav
> ffmpeg version N-46469-gc995644 Copyright (c) 2000-2012 the FFmpeg developers
>  built on Nov  5 2012 17:54:28 with gcc 4.7.2 (GCC)
>  configuration: --enable-gpl --enable-version3 --disable-pthreads --enable-runt
> ime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass -
> -enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enab
> le-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-libo
> pus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheo
> ra --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-li
> bvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --ena
> ble-zlib
>  libavutil      52.  5.100 / 52.  5.100
>  libavcodec     54. 71.100 / 54. 71.100
>  libavformat    54. 36.100 / 54. 36.100
>  libavdevice    54.  3.100 / 54.  3.100
>  libavfilter     3. 21.106 /  3. 21.106
>  libswscale      2.  1.102 /  2.  1.102
>  libswresample   0. 16.100 /  0. 16.100
>  libpostproc    52.  1.100 / 52.  1.100
> Guessed Channel Layout for  Input Stream #0.0 : stereo
> Input #0, wav, from 'd2.wav':
>  Metadata:
>    encoder         : Lavf54.36.100
>  Duration: 02:13:47.38, bitrate: 5816 kb/s
>    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16
> , 1536 kb/s
> At least one output file must be specified
> </pre>
> 
> That is "Duration: 02:13:47.38, bitrate: 5816 kb/s" instead of
> "size= 5699438kB time=08:26:37.00 bitrate=1536.0kbits/s"
> 
> 
> VirtualDub export correct wav ("aud.scenario.avs.avi.wav", approximately same size as "bad ffmpeg wav", but with correct length) without any problem.
> 
> <pre>
> D:\bug-export-wav>ffmpeg -i aud.scenario.avs.avi.wav
> ffmpeg version N-46469-gc995644 Copyright (c) 2000-2012 the FFmpeg developers
>  built on Nov  5 2012 17:54:28 with gcc 4.7.2 (GCC)
>  configuration: --enable-gpl --enable-version3 --disable-pthreads --enable-runt
> ime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass -
> -enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enab
> le-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-libo
> pus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheo
> ra --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-li
> bvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --ena
> ble-zlib
>  libavutil      52.  5.100 / 52.  5.100
>  libavcodec     54. 71.100 / 54. 71.100
>  libavformat    54. 36.100 / 54. 36.100
>  libavdevice    54.  3.100 / 54.  3.100
>  libavfilter     3. 21.106 /  3. 21.106
>  libswscale      2.  1.102 /  2.  1.102
>  libswresample   0. 16.100 /  0. 16.100
>  libpostproc    52.  1.100 / 52.  1.100
> [w64 @ 0036b400] max_analyze_duration 5000000 reached at 5013333
> [w64 @ 0036b400] Estimating duration from bitrate, this may be inaccurate
> Guessed Channel Layout for  Input Stream #0.0 : stereo
> Input #0, w64, from 'aud.scenario.avs.avi.wav':
>  Duration: 08:26:37.00, bitrate: 1535 kb/s
>    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16
> , 1536 kb/s
> At least one output file must be specified
> </pre>
> 
> 
> ----
> 
> I have this problem with every tried version of ffmpeg since 2010 (arrozcru/zeranoe builds), tried a lot of options — no success.
> 
> Is this bug or know feature?

The size of the audio data is too large to encapsulate within a standard WAV file. The WAV format uses 4 bytes to store the byte size of its chunks, so that largest data chunk can be 0xFFFFFFFF bytes or 4 gigabytes. The size of your audio data exceeds 0xFFFFFFFF so it looks like ffmpeg truncates your data size to the least endian f bytes (stereo 16 bit pcm at 48kHz is about six hours of data in four bytes which I suspect is why your durations are six hours off).

> Are the any workaroud?

You can't store more than 4 gigabytes in WAV. For workarounds you could:
- use WAVE 64, but FFmpeg supports w64 for demuxing but not muxing (could submit a ticket).
- use multiple output files to export segments in files that are smaller enough for the WAV format size constraints
- use another file format that doesn't have this size constraints: AIFF, MOV, MKA, NUT, etc
Dave Rice 

> 
>           Sincerely, Stas Fomin
> 
> P.S.
> (Sample files are too great, 17GB, but I can share if this will be useful).
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user



More information about the ffmpeg-user mailing list