Opened 5 years ago
Last modified 4 years ago
#8043 reopened enhancement
Nero and Quicktime format chapters
Reported by: | Naqros | Owned by: | |
---|---|---|---|
Priority: | wish | Component: | avformat |
Version: | git-master | Keywords: | mov |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
I've asked about this elsewhere before but have not gotten any possible solution to this issue that I have, I certainly haven't seen it anywhere else online so I am putting here as a feature request.
I've got this file, an MP4, here is part of the MediaInfo:
Menu 00:00:00.000 : CHAPTER01 00:00:23.133 : CHAPTER02 00:01:31.633 : CHAPTER03 00:02:05.100 : CHAPTER04 00:08:04.567 : CHAPTER05 00:16:03.133 : CHAPTER06 00:21:45.266 : CHAPTER07
So it has Nero formatted chapters embedded with mp4box. Then when I process this file further with ffmpeg it always comes out like this:
Menu #1 ID : 3 Codec ID : text Duration : 21 min 45 s Language : English Bit rate mode : CBR Menu For : 2 00:59:57.994 : CHAPTER01 01:00:21.127 : CHAPTER02 01:01:29.627 : CHAPTER03 01:02:03.094 : CHAPTER04 01:08:02.561 : CHAPTER05 01:16:01.127 : CHAPTER06 01:21:43.260 : CHAPTER07 Menu #2 00:00:00.000 : CHAPTER01 00:00:23.133 : CHAPTER02 00:01:31.633 : CHAPTER03 00:02:05.100 : CHAPTER04 00:08:04.567 : CHAPTER05 00:16:03.133 : CHAPTER06 00:21:45.266 : CHAPTER07
Now there are 2 chapter streams, I found out that the top is Quicktime formatted and then my original Nero formatted chapters are on the bottom.
Basically I want to only have the original Nero formatted (Menu #2) chapters as anything else makes these chapters not work at all in an Oppo Blu-ray player. The Oppo doesn't work with Quicktime format, and it doesn't work if both formats are present either.
I'm aware of the -movflags disable_chpl
but that gets rid of the Nero chapter and keeps the Quicktime chapters, I need to do the opposite.
Perhaps there is some sort of -map
or -map_metadata
or something that could be done for this use case but I have not found it. For time saving reasons I'd rather not have to embed the chapters with mp4box after ffmpeg as since I am basically doing a whole bunch of subtitle embedding and burning-in, that would result in 17 times the amount of chapter embedding as opposed to just adding chapters once before that to the source file. No matter what, I always get these Quicktime format chapters on the output of ffmpeg.
Chapter marks are embedded in a batch file with:
`mp4box.exe -add %input% -chap %chapters% "%output%\%inputfile%_chapters.mp4"`
Then later on in the workflow encoded with ffmpeg:
`"C:\Users\******\promo _chapters.mp4" -pix_fmt yuv420p -vf yadif -c: v libx264 -profile:v high -level 4.0 -preset fast -r 30000/1001 -vsync 1 -bf 1 - crf 18 -maxrate 12M -bufsize 12M -movflags +faststart -c:a aac -b:a 192k -ar 48K -f mp4 Z:\output\promo.mp4`
Here is the ffmpeg log:
ffmpeg -y -i "C:\Users\******\promo _chapters.mp4" -pix_fmt yuv420p -vf yadif -c: v libx264 -profile:v high -level 4.0 -preset fast -r 30000/1001 -vsync 1 -bf 1 - crf 18 -maxrate 12M -bufsize 12M -movflags +faststart -c:a aac -b:a 192k -ar 48K -f mp4 Z:\output\promo.mp4 ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 8.3.1 (GCC) 20190414 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfi g --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-lib freetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amr wb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy -- enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-l ibwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 -- enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --en able-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --en able-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --e nable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enab le-avisynth libavutil 56. 22.100 / 56. 22.100 libavcodec 58. 35.100 / 58. 35.100 libavformat 58. 20.100 / 58. 20.100 libavdevice 58. 5.100 / 58. 5.100 libavfilter 7. 40.101 / 7. 40.101 libswscale 5. 3.100 / 5. 3.100 libswresample 3. 3.100 / 3. 3.100 libpostproc 55. 3.100 / 55. 3.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Users\******\promo _chapters.mp4': Metadata: major_brand : isom minor_version : 1 compatible_brands: isom creation_time : 2019-07-14T20:51:43.000000Z Duration: 00:00:32.03, start: 0.000000, bitrate: 145729 kb/s Chapter #0:0: start 0.000000, end 5.166000 Metadata: title : CHAPTER01 Chapter #0:1: start 5.166000, end 10.233000 Metadata: title : CHAPTER02 Chapter #0:2: start 10.233000, end 14.867000 Metadata: title : CHAPTER03 Chapter #0:3: start 14.867000, end 21.367000 Metadata: title : CHAPTER04 Chapter #0:4: start 21.367000, end 24.400000 Metadata: title : CHAPTER05 Chapter #0:5: start 24.400000, end 29.333000 Metadata: title : CHAPTER06 Chapter #0:6: start 29.333000, end 32.032032 Metadata: title : CHAPTER07 Stream #0:0(und): Video: dnxhd (DNXHD) (AVdn / 0x6E645641), yuv422p(tv, bt70 9/unknown/unknown), 1920x1080, 145344 kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 t br, 29970 tbn, 29970 tbc (default) Metadata: creation_time : 2019-04-26T19:59:22.000000Z handler_name : ?Apple Video Media Handler encoder : Avid DNxHD Codec timecode : 00:59:58;00 Stream #0:1(und): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, stereo, s3 2 (24 bit), 2304 kb/s (default) Metadata: creation_time : 2019-04-26T19:59:22.000000Z handler_name : ?Apple Sound Media Handler Stream #0:2(und): Data: none (tmcd / 0x64636D74) (default) Metadata: creation_time : 2019-04-26T19:59:34.000000Z handler_name : ?Time Code Media Handler timecode : 00:59:58;00 Stream mapping: Stream #0:0 -> #0:0 (dnxhd (native) -> h264 (libx264)) Stream #0:1 -> #0:1 (pcm_s24le (native) -> aac (native)) Press [q] to stop, [?] for help [libx264 @ 00000000006c0140] using SAR=1/1 [libx264 @ 00000000006c0140] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264 @ 00000000006c0140] profile Progressive High, level 4.0, 4:2:0, 8-bit [libx264 @ 00000000006c0140] 264 - core 157 r2970 5493be8 - H.264/MPEG-4 AVC cod ec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 r ef=2 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=6 psy=1 psy_rd=1.00:0.00 mixed _ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pski p=1 chroma_qp_offset=-2 threads=34 lookahead_threads=5 sliced_threads=0 nr=0 dec imate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=1 b_pyramid=0 b _adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250 keyint_min= 25 scenecut=40 intra_refresh=0 rc_lookahead=30 rc=crf mbtree=1 crf=18.0 qcomp=0. 60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=12000 vbv_bufsize=12000 crf_max=0.0 nal _hrd=none filler=0 ip_ratio=1.40 aq=1:1.00 Output #0, mp4, to 'Z:\output\promo.mp4': Metadata: major_brand : isom minor_version : 1 compatible_brands: isom encoder : Lavf58.20.100 Chapter #0:0: start 0.000000, end 5.166000 Metadata: title : CHAPTER01 Chapter #0:1: start 5.166000, end 10.233000 Metadata: title : CHAPTER02 Chapter #0:2: start 10.233000, end 14.867000 Metadata: title : CHAPTER03 Chapter #0:3: start 14.867000, end 21.367000 Metadata: title : CHAPTER04 Chapter #0:4: start 21.367000, end 24.400000 Metadata: title : CHAPTER05 Chapter #0:5: start 24.400000, end 29.333000 Metadata: title : CHAPTER06 Chapter #0:6: start 29.333000, end 32.032032 Metadata: title : CHAPTER07 Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1 080 [SAR 1:1 DAR 16:9], q=-1--1, 0.03 fps, 30k tbn, 29.97 tbc (default) Metadata: creation_time : 2019-04-26T19:59:22.000000Z handler_name : ?Apple Video Media Handler timecode : 00:59:58;00 encoder : Lavc58.35.100 libx264 Side data: cpb: bitrate max/min/avg: 12000000/0/0 buffer size: 12000000 vbv_delay: -1 Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, flt p (24 bit), 192 kb/s (default) Metadata: creation_time : 2019-04-26T19:59:22.000000Z handler_name : ?Apple Sound Media Handler encoder : Lavc58.35.100 aac frame= 14 fps=0.0 q=0.0 size= 0kB time=00:00:00.93 bitrate= 1.8kbits/s frame= 43 fps= 43 q=0.0 size= 0kB time=00:00:02.00 bitrate= 0.8kbits/s frame= 74 fps= 49 q=24.0 size= 0kB time=00:00:03.28 bitrate= 0.5kbits/ frame= 124 fps= 62 q=24.0 size= 0kB time=00:00:04.69 bitrate= 0.4kbits/ frame= 166 fps= 66 q=24.0 size= 1536kB time=00:00:06.08 bitrate=2069.8kbits/ frame= 204 fps= 67 q=24.0 size= 3840kB time=00:00:07.48 bitrate=4201.3kbits/ frame= 242 fps= 69 q=26.0 size= 5632kB time=00:00:08.89 bitrate=5186.5kbits/ frame= 284 fps= 70 q=25.0 size= 7424kB time=00:00:10.28 bitrate=5914.7kbits/ frame= 325 fps= 72 q=24.0 size= 9472kB time=00:00:11.69 bitrate=6637.5kbits/ frame= 367 fps= 73 q=26.0 size= 11264kB time=00:00:13.09 bitrate=7044.7kbits/ frame= 407 fps= 73 q=28.0 size= 13056kB time=00:00:14.14 bitrate=7562.0kbits/ frame= 448 fps= 74 q=29.0 size= 15360kB time=00:00:15.44 bitrate=8146.9kbits/ frame= 491 fps= 75 q=26.0 size= 17664kB time=00:00:16.91 bitrate=8553.7kbits/ frame= 532 fps= 75 q=24.0 size= 19712kB time=00:00:18.30 bitrate=8822.2kbits/ frame= 574 fps= 76 q=24.0 size= 21504kB time=00:00:19.62 bitrate=8975.7kbits/ frame= 615 fps= 76 q=24.0 size= 23040kB time=00:00:21.03 bitrate=8973.1kbits/ frame= 656 fps= 76 q=27.0 size= 25088kB time=00:00:22.44 bitrate=9157.7kbits/ frame= 695 fps= 76 q=24.0 size= 27136kB time=00:00:23.82 bitrate=9328.8kbits/ frame= 736 fps= 77 q=25.0 size= 29184kB time=00:00:25.23 bitrate=9473.1kbits/ frame= 776 fps= 77 q=24.0 size= 30976kB time=00:00:26.64 bitrate=9523.5kbits/ frame= 813 fps= 77 q=24.0 size= 33024kB time=00:00:27.86 bitrate=9710.0kbits/ frame= 854 fps= 77 q=24.0 size= 34816kB time=00:00:28.97 bitrate=9844.9kbits/ frame= 896 fps= 77 q=24.0 size= 36352kB time=00:00:30.40 bitrate=9796.0kbits/ frame= 936 fps= 77 q=24.0 size= 37632kB time=00:00:31.78 bitrate=9698.5kbits/ [mp4 @ 000000000282e7c0] Starting second pass: moving the moov atom to the begin ning of the file frame= 960 fps= 62 q=-1.0 Lsize= 39818kB time=00:00:32.04 bitrate=10179.8kbit s/s speed=2.07x video:39018kB audio:763kB subtitle:0kB other streams:0kB global headers:0kB muxi ng overhead: 0.093123% [libx264 @ 00000000006c0140] frame I:11 Avg QP:16.42 size:119041 [libx264 @ 00000000006c0140] frame P:486 Avg QP:20.49 size: 62131 [libx264 @ 00000000006c0140] frame B:463 Avg QP:22.45 size: 18246 [libx264 @ 00000000006c0140] consecutive B-frames: 3.5% 96.5% [libx264 @ 00000000006c0140] mb I I16..4: 26.0% 64.5% 9.5% [libx264 @ 00000000006c0140] mb P I16..4: 4.2% 16.2% 1.6% P16..4: 37.2% 16.7 % 8.1% 0.0% 0.0% skip:16.0% [libx264 @ 00000000006c0140] mb B I16..4: 2.7% 7.4% 0.3% B16..8: 17.8% 5.6 % 0.4% direct:20.5% skip:45.4% L0:40.2% L1:47.0% BI:12.8% [libx264 @ 00000000006c0140] 8x8 transform intra:72.3% inter:69.6% [libx264 @ 00000000006c0140] coded y,uvDC,uvAC intra: 54.4% 80.0% 47.2% inter: 2 4.8% 38.9% 7.1% [libx264 @ 00000000006c0140] i16 v,h,dc,p: 34% 26% 12% 28% [libx264 @ 00000000006c0140] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 19% 25% 4% 5% 6% 5% 6% 5% [libx264 @ 00000000006c0140] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 22% 10% 5% 9% 8% 9% 6% 7% [libx264 @ 00000000006c0140] i8c dc,h,v,p: 51% 21% 20% 8% [libx264 @ 00000000006c0140] Weighted P-Frames: Y:6.8% UV:2.5% [libx264 @ 00000000006c0140] ref P L0: 79.5% 20.5% [libx264 @ 00000000006c0140] kb/s:9978.35 [aac @ 00000000006c69c0] Qavg: 3776.600
Change History (4)
follow-up: 4 comment:1 by , 4 years ago
Component: | ffmpeg → avformat |
---|---|
Keywords: | mov added; chapter mark nero quicktime chapters removed |
Version: | 4.1 → git-master |
comment:2 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Awesome!
That handled it, Nero chapters just pass through now without the quicktime chapters being generated.
Thank-you so much!
comment:3 by , 4 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:4 by , 4 years ago
Replying to cehoyos:
Does the following change (inlined) fix the chapters for you?
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index fb44ee2c71..29ff5c46e4 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -6285,7 +6285,7 @@ static int mov_init(AVFormatContext *s) } mov->nb_streams = s->nb_streams; - if (mov->mode & (MODE_MP4|MODE_MOV|MODE_IPOD) && s->nb_chapters) + if (0 && mov->mode & (MODE_MP4|MODE_MOV|MODE_IPOD) && s->nb_chapters) mov->chapter_track = mov->nb_streams++; if (mov->flags & FF_MOV_FLAG_RTP_HINT) { @@ -6821,7 +6821,7 @@ static int mov_write_trailer(AVFormatContext *s) // If there were no chapters when the header was written, but there // are chapters now, write them in the trailer. This only works // when we are not doing fragments. - if (!mov->chapter_track && !(mov->flags & FF_MOV_FLAG_FRAGMENT)) { + if (0 && !mov->chapter_track && !(mov->flags & FF_MOV_FLAG_FRAGMENT)) { if (mov->mode & (MODE_MP4|MODE_MOV|MODE_IPOD) && s->nb_chapters) { mov->chapter_track = mov->nb_streams++; if ((res = mov_create_chapter_track(s, mov->chapter_track)) < 0)
Any idea why this wouldn't be working for me in Linux? Worked perfectly after compiling for Windows, but I've tried a few times and can't get it to not create the Quicktime chapters after compiling in Linux.
Does the following change (inlined) fix the chapters for you?