#7184 closed defect (fixed)
ffmetadata time are not treated as miliseconds as documentation says
Reported by: | Jonatã Bolzan Loss | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | documentation |
Version: | git-master | Keywords: | ffmetadata |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary: documentation says that ffmetadata time information (ex. "START", "END") needs to be written in miliseconds:
https://ffmpeg.org/ffmpeg-formats.html#Metadata-1
7. ... If the timebase is missing then start/end times are assumed to be in milliseconds.
The documentation should say nanosecond, or ffmpeg is not reading this information correctly.
How to reproduce:
Test movie file:
https://archive.org/download/mov-bbb/mov_bbb.mp4
In this example, I am not specifying the TIMEBASE, because the documentation says that if this information is not present, ffmpeg will consider times as miliseconds int.
I want a chapter at 1 sec and at 2 sec. Milisecond is a thousandth of a second.
(https://en.wikipedia.org/wiki/Millisecond).
1 * 1.000 = 1000
2 * 1.000 = 2000
Considering the following is the content of "chapters.txt":
;FFMETADATA1 [CHAPTER] START=1000 END=2000 title=First chapter [CHAPTER] START=2000 END=4000 title=Second chapter should start at 2 sec
Applying chapters:
ffmpeg -i mov_bbb.mp4 -i chapters.txt -map_chapters 1 -c:a copy -c:v copy mov_bbb_with_chapters.mp4
ffmpeg version N-90883-g29fd44adf1 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 7 (Ubuntu 7.3.0-16ubuntu3) configuration: --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-version3 libavutil 56. 17.100 / 56. 17.100 libavcodec 58. 19.100 / 58. 19.100 libavformat 58. 13.100 / 58. 13.100 libavdevice 58. 4.100 / 58. 4.100 libavfilter 7. 20.100 / 7. 20.100 libswscale 5. 2.100 / 5. 2.100 libswresample 3. 2.100 / 3. 2.100 libpostproc 55. 2.100 / 55. 2.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'mov_bbb.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42isomavc1 creation_time : 2012-03-13T08:58:06.000000Z encoder : HandBrake 0.9.6 2012022800 Duration: 00:00:10.03, start: 0.000000, bitrate: 629 kb/s Chapter #0:0: start 0.000000, end 10.000000 Metadata: title : Chapter 1 Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 320x176, 300 kb/s, 25 fps, 25 tbr, 90k tbn, 180k tbc (default) Metadata: creation_time : 2012-03-13T08:58:06.000000Z encoder : JVT/AVC Coding Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default) Metadata: creation_time : 2012-03-13T08:58:06.000000Z Stream #0:2(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s Metadata: creation_time : 2012-03-13T08:58:06.000000Z Stream #0:3(und): Data: bin_data (text / 0x74786574), 0 kb/s Metadata: creation_time : 2012-03-13T08:58:06.000000Z Input #1, ffmetadata, from 'chapters.txt': Duration: 00:00:00.00, start: 0.000000, bitrate: 280000 kb/s Chapter #1:0: start 0.000001, end 0.000002 Metadata: title : First chapter Chapter #1:1: start 0.000002, end 0.000004 Metadata: title : Second chapter should start at 2 sec Output #0, mp4, to 'mov_bbb_with_chapters.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42isomavc1 encoder : Lavf58.13.100 Chapter #0:0: start 0.000001, end 0.000002 Metadata: title : First chapter Chapter #0:1: start 0.000002, end 0.000004 Metadata: title : Second chapter should start at 2 sec Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 320x176, q=2-31, 300 kb/s, 25 fps, 25 tbr, 90k tbn, 90k tbc (default) Metadata: creation_time : 2012-03-13T08:58:06.000000Z encoder : JVT/AVC Coding Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default) Metadata: creation_time : 2012-03-13T08:58:06.000000Z Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help frame= 250 fps=0.0 q=-1.0 Lsize= 573kB time=00:00:10.00 bitrate= 469.0kbits/s speed= 430x video:367kB audio:197kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.671260%
As shown in output, the chapters are not in the correct place.
So, I need to convert the times to nanosecond, that is is a thousand-millionth of a second.
(https://en.wikipedia.org/wiki/Nanosecond).
1 * 1.000.000.000 = 1000000000
2 * 1.000.000.000 = 2000000000
Considering the following is the content of "chapters.txt":
;FFMETADATA1 [CHAPTER] START=1000000000 END=2000000000 title=First chapter [CHAPTER] START=2000000000 END=4000000000 title=Second chapter should start at 2 sec
Applying chapters:
ffmpeg -i mov_bbb.mp4 -i chapters.txt -map_chapters 1 -c:a copy -c:v copy mov_bbb_with_chapters.mp4
ffmpeg version N-90883-g29fd44adf1 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 7 (Ubuntu 7.3.0-16ubuntu3) configuration: --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-version3 libavutil 56. 17.100 / 56. 17.100 libavcodec 58. 19.100 / 58. 19.100 libavformat 58. 13.100 / 58. 13.100 libavdevice 58. 4.100 / 58. 4.100 libavfilter 7. 20.100 / 7. 20.100 libswscale 5. 2.100 / 5. 2.100 libswresample 3. 2.100 / 3. 2.100 libpostproc 55. 2.100 / 55. 2.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'mov_bbb.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42isomavc1 creation_time : 2012-03-13T08:58:06.000000Z encoder : HandBrake 0.9.6 2012022800 Duration: 00:00:10.03, start: 0.000000, bitrate: 629 kb/s Chapter #0:0: start 0.000000, end 10.000000 Metadata: title : Chapter 1 Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 320x176, 300 kb/s, 25 fps, 25 tbr, 90k tbn, 180k tbc (default) Metadata: creation_time : 2012-03-13T08:58:06.000000Z encoder : JVT/AVC Coding Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default) Metadata: creation_time : 2012-03-13T08:58:06.000000Z Stream #0:2(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s Metadata: creation_time : 2012-03-13T08:58:06.000000Z Stream #0:3(und): Data: bin_data (text / 0x74786574), 0 kb/s Metadata: creation_time : 2012-03-13T08:58:06.000000Z Input #1, ffmetadata, from 'chapters.txt': Duration: 00:00:04.00, start: 0.000000, bitrate: 0 kb/s Chapter #1:0: start 1.000000, end 2.000000 Metadata: title : First chapter Chapter #1:1: start 2.000000, end 4.000000 Metadata: title : Second chapter should start at 2 sec Output #0, mp4, to 'mov_bbb_with_chapters.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42isomavc1 encoder : Lavf58.13.100 Chapter #0:0: start 1.000000, end 2.000000 Metadata: title : First chapter Chapter #0:1: start 2.000000, end 4.000000 Metadata: title : Second chapter should start at 2 sec Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 320x176, q=2-31, 300 kb/s, 25 fps, 25 tbr, 90k tbn, 90k tbc (default) Metadata: creation_time : 2012-03-13T08:58:06.000000Z encoder : JVT/AVC Coding Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default) Metadata: creation_time : 2012-03-13T08:58:06.000000Z Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help frame= 250 fps=0.0 q=-1.0 Lsize= 573kB time=00:00:10.00 bitrate= 469.0kbits/s speed= 635x video:367kB audio:197kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.671260%
Change History (3)
comment:1 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 by , 6 years ago
Component: | ffmpeg → documentation |
---|---|
Keywords: | ffmetadata added |
Priority: | normal → minor |
comment:3 by , 6 years ago
Priority: | minor → normal |
---|
Fixed in ddefd05507fdf4391485f9985e80e4672486dbfd.