Opened 13 years ago
Closed 13 years ago
#445 closed defect (fixed)
Wrong FLV duration metadata field
| Reported by: | burek | Owned by: | Michael Niedermayer |
|---|---|---|---|
| Priority: | minor | Component: | ffmpeg |
| Version: | git-master | Keywords: | flv meta duration |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | yes | |
| Analyzed by developer: | no |
Description
When ffmpeg is used like this:
ffmpeg -t 00:00:30 -i valid.flv -acodec copy -vcodec copy invalid.flv
(extracting a part of the video to a new file) then the resulting file (invalid.flv) contains wrong duration metadata field (copied from the original 'valid.flv') which confuses all FLV web players, because the navigation can't be accurate because of that.
I personally always use "flvmeta -Uf invalid.flv" after this kind of cutting, but it would be nice if ffmpeg would actually write correct values in the output file
Change History (3)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
I'm not sure what output do you need, because it happens with hundreds of videos I've been working for so far. For example:
ffmpeg -f video4linux2 -i /dev/video0 -vcodec libx264 -crf 20 -threads 0 out.flv
and then
ffmpeg -ss 00:01:00 -t 00:00:25 -i out.flv -acodec copy -vcodec copy sample.flv
The file sample.flv has got an invalid metadata "duration" field.
Here is the actual example:
# ffmpeg -i final.flv
ffmpeg version git-2011-08-19-ada49f9, Copyright (c) 2000-2011 the FFmpeg developers
built on Sep 5 2011 12:41:18 with gcc 4.6.1
configuration: --enable-static --enable-shared --enable-gpl --enable-nonfree --enable-postproc --enable-runtime-cpudetect --enable-bzlib --enable-libfaac --enable-libopenjpeg --enable-libx264 --enable-zlib --enable-libaacplus --enable-libfaac --extra-cflags=-fPIC
libavutil 51. 12. 0 / 51. 12. 0
libavcodec 53. 11. 0 / 53. 11. 0
libavformat 53. 8. 0 / 53. 8. 0
libavdevice 53. 3. 0 / 53. 3. 0
libavfilter 2. 32. 0 / 2. 32. 0
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0
[flv @ 0x1f0c420] Estimating duration from bitrate, this may be inaccurate
Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1) -> 50.00 (50/1)
Input #0, flv, from 'final.flv':
Metadata:
duration : 21117
width : 320
height : 240
videodatarate : 118
framerate : 50
videocodecid : 7
audiodatarate : 31
audiosamplerate : 44100
audiosamplesize : 16
stereo : true
audiocodecid : 10
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.8.0
filesize : 421422299
Duration: 05:51:57.33, start: 0.040000, bitrate: 152 kb/s
Stream #0.0: Video: h264 (High), yuv420p, 320x240, 120 kb/s, 50 tbr, 1k tbn, 50 tbc
Stream #0.1: Audio: aac, 44100 Hz, 2 channels (FC), s16, 32 kb/s
At least one output file must be specified
and then
# ffmpeg -ss 00:00:10 -t 00:00:30 -i final.flv -acodec copy -vcodec copy sample.flv
ffmpeg version git-2011-08-19-ada49f9, Copyright (c) 2000-2011 the FFmpeg developers
built on Sep 5 2011 12:41:18 with gcc 4.6.1
configuration: --enable-static --enable-shared --enable-gpl --enable-nonfree --enable-postproc --enable-runtime-cpudetect --enable-bzlib --enable-libfaac --enable-libopenjpeg --enable-libx264 --enable-zlib --enable-libaacplus --enable-libfaac --extra-cflags=-fPIC
libavutil 51. 12. 0 / 51. 12. 0
libavcodec 53. 11. 0 / 53. 11. 0
libavformat 53. 8. 0 / 53. 8. 0
libavdevice 53. 3. 0 / 53. 3. 0
libavfilter 2. 32. 0 / 2. 32. 0
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0
[flv @ 0x82f420] Estimating duration from bitrate, this may be inaccurate
Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1) -> 50.00 (50/1)
Input #0, flv, from 'final.flv':
Metadata:
duration : 21117
width : 320
height : 240
videodatarate : 118
framerate : 50
videocodecid : 7
audiodatarate : 31
audiosamplerate : 44100
audiosamplesize : 16
stereo : true
audiocodecid : 10
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.8.0
filesize : 421422299
Duration: 05:51:57.33, start: 0.040000, bitrate: 152 kb/s
Stream #0.0: Video: h264 (High), yuv420p, 320x240, 120 kb/s, 50 tbr, 1k tbn, 50 tbc
Stream #0.1: Audio: aac, 44100 Hz, 2 channels (FC), s16, 32 kb/s
Output #0, flv, to 'sample.flv':
Metadata:
duration : 21117
width : 320
height : 240
videodatarate : 118
framerate : 50
videocodecid : 7
audiodatarate : 31
audiosamplerate : 44100
audiosamplesize : 16
stereo : true
audiocodecid : 10
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
creation_time : 1970-01-01 00:00:00
filesize : 421422299
encoder : Lavf53.8.0
Stream #0.0: Video: libx264, yuv420p, 320x240, q=2-31, 120 kb/s, 1k tbn, 1k tbc
Stream #0.1: Audio: libaacplus, 44100 Hz, 2 channels (FC), 32 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop, [?] for help
frame= 780 fps= 0 q=-1.0 Lsize= 629kB time=00:00:29.96 bitrate= 172.1kbits/s
video:480kB audio:122kB global headers:0kB muxing overhead 4.504534%
so, sample.flv has got wrong duration (21117 instead of 25 or 31, i guess it's just been copied from the original flv file, i.e. not calculated):
# ffmpeg -i sample.flv
ffmpeg version git-2011-08-19-ada49f9, Copyright (c) 2000-2011 the FFmpeg developers
built on Sep 5 2011 12:41:18 with gcc 4.6.1
configuration: --enable-static --enable-shared --enable-gpl --enable-nonfree --enable-postproc --enable-runtime-cpudetect --enable-bzlib --enable-libfaac --enable-libopenjpeg --enable-libx264 --enable-zlib --enable-libaacplus --enable-libfaac --extra-cflags=-fPIC
libavutil 51. 12. 0 / 51. 12. 0
libavcodec 53. 11. 0 / 53. 11. 0
libavformat 53. 8. 0 / 53. 8. 0
libavdevice 53. 3. 0 / 53. 3. 0
libavfilter 2. 32. 0 / 2. 32. 0
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0
[flv @ 0x65a420] Estimating duration from bitrate, this may be inaccurate
Input #0, flv, from 'sample.flv':
Metadata:
stereo : true
duration : 21117
width : 320
height : 240
videodatarate : 118
framerate : 50
videocodecid : 7
audiodatarate : 31
audiosamplerate : 44100
audiosamplesize : 16
audiocodecid : 10
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.8.0
filesize : 644492
Duration: 00:00:31.32, start: 0.024000, bitrate: 152 kb/s
Stream #0.0: Video: h264 (High), yuv420p, 320x240, 120 kb/s, 25 tbr, 1k tbn, 50 tbc
Stream #0.1: Audio: aac, 44100 Hz, 2 channels (FC), s16, 32 kb/s
At least one output file must be specified
comment:3 by , 13 years ago
| Reproduced by developer: | set |
|---|---|
| Resolution: | → fixed |
| Status: | new → closed |
locally fixed, will be pushed soon



Complete, uncut output missing.