Opened 12 years ago
Closed 10 years ago
#1937 closed enhancement (fixed)
cdxl: wrong duration
Reported by: | ami_stuff | Owned by: | |
---|---|---|---|
Priority: | wish | Component: | avformat |
Version: | git-master | Keywords: | cdxl |
Cc: | Michael Niedermayer | Blocked By: | |
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | no |
Description
C:\>ffmpeg -i Fruit.CDXL out.avi ffmpeg version N-46755-ge70144c Copyright (c) 2000-2012 the FFmpeg developers built on Nov 15 2012 02:38:20 with gcc 4.5.0 (GCC) 20100414 (Fedora MinGW 4.5. 0-1.fc14) configuration: --prefix=/var/www/users/research/ffmpeg/snapshots/build --arch= x86 --target-os=mingw32 --cross-prefix=i686-pc-mingw32- --cc='ccache i686-pc-min gw32-gcc' --enable-w32threads --enable-memalign-hack --enable-runtime-cpudetect --enable-cross-compile --enable-static --disable-shared --extra-libs='-lws2_32 - lwinmm -lpthread' --extra-cflags='--static -I/var/www/users/research/ffmpeg/snap shots/build/include' --extra-ldflags='-static -L/var/www/users/research/ffmpeg/s napshots/build/lib' --enable-bzlib --enable-zlib --enable-gpl --enable-version3 --enable-nonfree --enable-libx264 --enable-libspeex --enable-libtheora --enable- libvorbis --enable-libfaac --enable-libxvid --enable-libopencore-amrnb --enable- libopencore-amrwb --enable-libmp3lame --enable-libvpx --disable-decoder=libvpx libavutil 52. 6.100 / 52. 6.100 libavcodec 54. 71.100 / 54. 71.100 libavformat 54. 36.100 / 54. 36.100 libavdevice 54. 3.100 / 54. 3.100 libavfilter 3. 23.100 / 3. 23.100 libswscale 2. 1.102 / 2. 1.102 libswresample 0. 16.100 / 0. 16.100 libpostproc 52. 1.100 / 52. 1.100 [cdxl @ 0x1edc2c0] Estimating duration from bitrate, this may be inaccurate Input #0, cdxl, from 'Fruit.CDXL': Duration: 00:01:15.54, start: 0.000000, bitrate: 88 kb/s Stream #0:0: Video: cdxl, pal8, 128x80, 29.97 fps, 29.96 tbr, 11025 tbn Stream #0:1: Audio: pcm_s8, 11025 Hz, mono, u8, 88 kb/s Output #0, avi, to 'out.avi': Metadata: ISFT : Lavf54.36.100 Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 128x80, q=2-31, 200 kb/s, 29.96 tbn, 29.96 tbc Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 11025 Hz, mono, s16p Stream mapping: Stream #0:0 -> #0:0 (cdxl -> mpeg4) Stream #0:1 -> #0:1 (pcm_s8 -> libmp3lame) Press [q] to stop, [?] for help frame= 150 fps=0.0 q=2.0 Lsize= 89kB time=00:00:05.01 bitrate= 145.6kbits/ s video:64kB audio:10kB subtitle:0 global headers:0kB muxing overhead 21.236188%
Attachments (2)
Change History (15)
by , 12 years ago
Attachment: | Fruit.CDXL added |
---|
comment:1 by , 12 years ago
Keywords: | cdxl added |
---|---|
Reproduced by developer: | set |
Status: | new → open |
Version: | unspecified → git-master |
follow-up: 3 comment:2 by , 12 years ago
the correct duration shoud be calculated like this:
int64_t filesize = avio_size(s->pb);
st->duration = (filesize /* - audiotrack_size */ ) / video_size / calculated_fps;
follow-up: 4 comment:3 by , 12 years ago
Replying to ami_stuff:
the correct duration shoud be calculated like this:
int64_t filesize = avio_size(s->pb);
st->duration = (filesize /* - audiotrack_size */ ) / video_size / calculated_fps;
If "video_size" and "calculated_fps" are known, wouldn't it be much easier to set the bitrate?
comment:4 by , 12 years ago
Replying to cehoyos:
If "video_size" and "calculated_fps" are known, wouldn't it be much easier to set the video bitrate?
True, but I have a problem with fps. Any idea how do I get value printed by ffmpeg?
st->codec->bit_rate = (video_size * 8) /* * av_q2d(st->avg_frame_rate) /*
?
comment:5 by , 12 years ago
There is an if-then-else-block "if (cdxl->framerate)" inside the else-block of "if (cdxl->read_chunk && audio_size)", if the user did not specify a frame-rate, it may be possible to use the sample_rate instead.
by , 12 years ago
Attachment: | cdxl2.diff added |
---|
comment:6 by , 12 years ago
Attached patch works for me (I couldn't get correct values while setting bit_rate).
It looks like Amiga software calculates duration the same way:
xlinfo fruit.cdxl XLInfo 1.10 by Pantaray, Inc. Ukiah CA Type Frame # Size Back Image Audio X Y Pixel CMap FIRST 1.0000 0000001 5552 0 5120 368 128 80 4 32 EST Total Frames: 150, Total Bytes 5552 out of 832800 Total Playing Time (at aprox. 27.68 FPS) Seconds: 05.42
follow-up: 8 comment:7 by , 12 years ago
You could use the frame-counter in "AV_RB16(&cdxl->header[12]);" (I don't know if it is better, but it is possible).
What happens if the user set the framerate?
comment:8 by , 12 years ago
Replying to cehoyos:
You could use the frame-counter in "AV_RB16(&cdxl->header[12]);" (I don't know if it is better, but it is possible).
This value changes to random number at probing.
(for example when you use -framerate 5 then it will change to 28 from 150)
What happens if the user set the framerate?
I fixed this case - patch sent to ml.
comment:9 by , 12 years ago
Component: | undetermined → avformat |
---|---|
Priority: | normal → wish |
Type: | defect → enhancement |
comment:10 by , 10 years ago
does cdxl store the number of frames or bitrate somewhere ?
if not (and i dont see where) then the patch from ami is probably the best that can be done without reading the whole file
comment:11 by , 10 years ago
Cc: | added |
---|
comment:12 by , 10 years ago
Cc: | added; removed |
---|
comment:13 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | open → closed |
Fixed in 75cc85b23970b1238d6e3107ac817120e42a6686 by applying ami_stuffs patch