Ticket #2145 (new defect)
avi files >1G do not seek with WMP
| Reported by: | cehoyos | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | avformat |
| Version: | git-master | Keywords: | avi |
| Cc: | tateu | Blocked By: | |
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description (last modified by cehoyos) (diff)
(bug 194)
If an avi output file is bigger than ~1G, the file starts to play fine with WMP, but seeking is impossible, this works fine if the file is remuxed with MEncoder.
The following file plays fine with WMP, seeking works as expected:
$ ffmpeg -f lavfi -i testsrc=s=pal -f s16le -ac 2 -ar 48k -i /dev/zero -vcodec dvvideo -acodec pcm_s16le -fs 900M out09.avi
The following file also plays fine with WMP, playback stops when the user tries to seek:
$ ffmpeg -f lavfi -i testsrc=s=pal -f s16le -ac 2 -ar 48k -i /dev/zero -vcodec dvvideo -acodec pcm_s16le -fs 1100M out11.avi
ffmpeg version N-48954-g06af724 Copyright (c) 2000-2013 the FFmpeg developers
built on Jan 16 2013 12:08:10 with gcc 4.7 (SUSE Linux)
configuration: --enable-gpl --disable-indev=jack
libavutil 52. 15.100 / 52. 15.100
libavcodec 54. 89.100 / 54. 89.100
libavformat 54. 60.101 / 54. 60.101
libavdevice 54. 3.102 / 54. 3.102
libavfilter 3. 32.100 / 3. 32.100
libswscale 2. 1.103 / 2. 1.103
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
[lavfi @ 0x2539940] Estimating duration from bitrate, this may be inaccurate
Input #0, lavfi, from 'testsrc=s=pal':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 720x576 [SAR 1:1 DAR 5:4], 25 tbr, 25 tbn, 25 tbc
[s16le @ 0x253b0c0] max_analyze_duration 5000000 reached at 5013333 microseconds
[s16le @ 0x253b0c0] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, s16le, from '/dev/zero':
Duration: N/A, bitrate: 1536 kb/s
Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Output #0, avi, to 'out11.avi':
Metadata:
ISFT : Lavf54.60.101
Stream #0:0: Video: dvvideo (dvsd / 0x64737664), yuv420p, 720x576 [SAR 1:1 DAR 5:4], q=2-31, 200 kb/s, 25 tbn, 25 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo -> dvvideo)
Stream #1:0 -> #0:1 (pcm_s16le -> pcm_s16le)
Press [q] to stop, [?] for help
frame= 7248 fps=431 q=0.0 Lsize= 1074263kB time=00:04:49.92 bitrate=30354.5kbits/s
video:1019250kB audio:54360kB subtitle:0 global headers:0kB muxing overhead 0.060863%
The file can be "fixed" with the following MEncoder command line:
$ mencoder out11.avi -ovc copy -oac copy -o outmenc.avi
Attachments
Change History
comment:3 follow-up: ↓ 5 Changed 8 weeks ago by tateu
I don't know if it's the same issue as I am having, it sounds similar. I cannot even open AVI's > 1GB in Windows Media Player if they are bgr24 rawvideo. I have found a fix for my issue. On line 270 of libavformat/avienc.c it currently says "/* suggested buffer size */ FIXME set at the end to largest chunk" but no one has ever added the FIXME.
I've attached two patches which work for me. The first one I think is definitely needed and changes the dwSuggestedBufferSize attribute of the strh header. The 2nd one doesn't seem 100% necessary but it sets the dwMaxBytesPerSec and dwSuggestedBufferSize attributes of the avih header to 0. VirtualDub? and Mencoder both set this dwSuggestedBufferSize attribute to 0. VirtualDub? sets this dwMaxBytesPerSec attribute to a value very close to (strh->dwSuggestedBufferSize * frame_rate) and Mencoder sets it to 0.
comment:4 Changed 8 weeks ago by cehoyos
Please send patches to ffmpeg-devel, they receive more attention there.
comment:5 in reply to: ↑ 3 Changed 8 weeks ago by cehoyos
- Cc tateu added
Replying to tateu:
I don't know if it's the same issue as I am having, it sounds similar. I cannot even open AVI's > 1GB in Windows Media Player if they are bgr24 rawvideo.
I tested the following command line:
$ ffmpeg -f lavfi -i testsrc -vcodec rawvideo -pix_fmt bgr24 -fs 1100M out.avi
The output file plays fine with Windows Media Player.
Please provide your failing command line together with the complete, uncut console output.
comment:6 Changed 8 weeks ago by cehoyos
The original problem is only reproducible with pcm audio, if ac3 (or mp2) encoding or no audio is selected, seeking with WMP works fine.
comment:7 follow-up: ↓ 8 Changed 8 weeks ago by tateu
ffmpeg -f lavfi -i testsrc=size=1280x720 -vcodec rawvideo -pix_fmt bgr24 -fs 1100M out.avi
To see the issue I am talking about, individual frame sizes need to be larger than the default value that FFMpeg uses for strh->dwSuggestedBufferSize, which is 1,048,576 bytes. Your command line produces a 320x240 file and each frame is only 230,400 bytes (320 * 240 * 3). testsrc=size=1280x720 produces a file where each frame is 2,764,800 bytes. You also need to disable any 3rd party AVI directshow splitters to make sure it is only a vanilla Windows Media Player attempting to play the file. Haali media splitter can take over from Windows and make the file playable.
My issue seems to be slightly different than yours, then. I had tried your example without audio since I'm on Windows and don't have -i /dev/zero as an input source. My patch fixes my issue but does not fix yours.
comment:8 in reply to: ↑ 7 Changed 8 weeks ago by cehoyos
Replying to tateu:
My issue seems to be slightly different than yours, then. I had tried your example without audio since I'm on Windows and don't have -i /dev/zero as an input source.
You can use the following command line to produce video and audio:
$ ffmpeg -f lavfi -i testsrc -f lavfi -i "aevalsrc=sin(2*PI*t*440)"
My patch fixes my issue but does not fix yours.
Please post your patch to ffmpeg-devel (alternatively, you can open a new ticket, but it makes more sense to fix it).



