October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
DocumentaryTube
chapter markers

How to Encode a Long YouTube Playlist with FFmpeg and Preserve Chapter Markers

A practical guide to downloading playlist items in order, joining them with FFmpeg, creating or mapping chapter markers, and checking the finished file.

By DocumentaryTube Team 7 min read
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To join a long YouTube playlist into one file and mark each playlist item as a chapter, first download the videos as separate, playlist-indexed files. If their streams are compatible, join them with FFmpeg’s concat demuxer and its chapter_per_file option. If you need to re-encode or the files have incompatible stream layouts, use a concat-filter workflow and explicitly create or map chapter metadata. Then inspect the output’s chapters with ffprobe and check it in the player where you plan to use it.

Choose a workflow before joining the files

Workflow Use it when Trade-offs
Concat demuxer with stream copy Files have compatible stream layouts, codecs, and time bases, and you do not need to re-encode. Fast and avoids another lossy encoding generation. Incorrect or unknown durations can shift later timestamps or affect chapter boundaries.
Concat filter with re-encoding Files differ in format or stream layout, or you need a consistent output profile. Lets you set output properties, but requires more processing and may reduce quality. Chapter boundaries must be calculated or mapped deliberately.
yt-dlp playlist concatenation The playlist files satisfy yt-dlp’s concatenation requirements and a concatenated download is the desired result. Items must have the same codecs and number of streams. Treat chapter authoring and validation as a separate task.

FFmpeg’s concat demuxer is not a general-purpose way to join arbitrary files without re-encoding. If stream compatibility is uncertain, inspect the files first and choose a common output profile rather than attempting a blind stream-copy join.

Download the playlist in a recoverable order

Preserve each item as a separate file until the final output is verified. Include the playlist index in filenames so the intended order is explicit, and keep the manifest and command log with the job. yt-dlp documents playlist-indexed output templates and a download archive that records successfully downloaded IDs, helping track order and skip completed items in a later run. See the yt-dlp output-template documentation and download archive documentation.

For example, a template can include the playlist name, index, and title:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
yt-dlp -o "%(playlist_title)s/%(playlist_index)03d - %(title)s.%(ext)s" PLAYLIST_URL

Replace PLAYLIST_URL with the playlist address. Confirm the resulting filenames are ordered as intended before creating the concat list. Keep source files, temporary outputs, and the final file in separate locations so an interrupted encode does not replace the only copy of the inputs.

Join compatible files with the concat demuxer

Create an ordered manifest

Make a text file such as inputs.txt with one entry per file, in playlist order:

file '001 - First item.mp4'
file '002 - Second item.mp4'
file '003 - Third item.mp4'

Paths in a concat script have their own quoting and escaping rules. Take care with filenames containing spaces, apostrophes, or other special characters. The demuxer uses safe relative paths by default. Its safe=0 option permits arbitrary names and paths, but use it only with a manifest you control.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Enable one chapter per file

Run FFmpeg with the concat demuxer, stream copy, and chapter_per_file:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ffmpeg -f concat -chapter_per_file 1 -i inputs.txt -map 0 -c copy -map_chapters 0 joined.mp4

The concat demuxer creates a chapter for each listed file. It uses the file’s title metadata as the chapter name when available; otherwise it uses the filename. The chapter times depend on input durations, so make sure those durations are known and accurate. An inaccurate duration can shift later timestamps and lead to gaps or artifacts. FFmpeg’s concat demuxer documentation describes the option and duration behavior.

Check that the installed FFmpeg version accepts these options. The documented option name is chapter_per_file; command-line option availability can vary with the version and build. If FFmpeg reports an unrecognized option, consult the documentation for the version installed rather than assuming the same command applies.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Re-encode when the source streams are incompatible

Use the concat filter when the files have different codecs, stream layouts, or other properties that prevent reliable demuxer concatenation, or when you need to normalize them. The filter joins decoded streams, which are then encoded to the output format. Specify the video and audio inputs and output settings that match your chosen profile; there is no single resolution, frame rate, bitrate, or codec setting that is right for every playlist.

For a long playlist, build a concat-filter graph covering every segment and ensure the streams you concatenate have compatible dimensions, pixel formats, sample rates, and channel layouts. Normalize mismatches before concatenation where necessary. FFmpeg’s FAQ recommends the concat filter when re-encoding.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Re-encoding does not automatically remove chapter metadata. FFmpeg ordinarily maps chapters from the first input that contains chapters. If the chapter source is ambiguous, select it explicitly with -map_chapters, or disable chapter copying with a negative input index when you intend to author new chapters. Mapping chapters is separate from mapping audio and video streams. See FFmpeg’s advanced options.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2Ă— USB C male to USB A female adapters and 2Ă— USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Preserve existing chapters or author new ones

Select existing chapter metadata

To choose which input supplies chapter metadata, use -map_chapters input_file_index, where the index is the input number in the FFmpeg command. For example, -map_chapters 0 selects the first input. If omitted, FFmpeg copies chapters from the first input that contains any; a negative input index disables chapter copying. When using a concat-filter command with multiple inputs, decide whether an input’s existing chapters match the joined output timeline. Source chapters may not describe the boundaries you want after concatenation.

Create chapter markers with an FFMETADATA file

When there are no suitable existing chapters, create an FFMETADATA file with a chapter section for each intended segment. The documented format starts with ;FFMETADATA; each chapter needs an explicit time base, start, end, and title. For example:

;FFMETADATA1
[CHAPTER]
TIMEBASE=1/1000
START=0
END=180000
title=First item
[CHAPTER]
TIMEBASE=1/1000
START=180000
END=420000
title=Second item

Here the boundaries are illustrative values expressed in the declared time base, not measurements for a particular playlist. Calculate boundaries from the actual segment durations in the output timeline. Use non-overlapping start and end values that cover the intended sections, and title each chapter as you want it displayed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

FFmpeg can take the metadata file as an additional input and use it as the chapter source; map the video and audio from the media input, and map chapters from the metadata input. For instance, with the media as input 0 and metadata as input 1, use -map_chapters 1. The exact command depends on whether the media is being stream-copied or filtered and re-encoded. The FFMETADATA documentation describes the file format and chapter fields.

Verify chapter boundaries and playback

A successful encode does not guarantee that chapter navigation will appear in every container and player. Inspect the output’s streams, duration, and chapter entries, then test representative boundaries in the application you expect to use.

ffprobe -v error -show_format -show_streams -show_chapters -of json joined.mp4

Check that the output contains the expected number of chapters, sensible start and end times, and the intended titles. Play the beginning, one or more transitions, and the end. If a boundary is wrong, revisit source durations or the manually authored timestamps. If chapter data appears in ffprobe but not in the player, the issue may be container or player support rather than a failed encode; compatibility is not universal.

Common problems and fixes

  • FFmpeg reports mismatched streams or concatenation fails: the files may not have compatible stream structures, codecs, or time bases. Use the concat filter and re-encode to a consistent profile instead of forcing a stream-copy join.
  • Later chapters drift or the output has gaps or artifacts: check that each segment’s duration is known and accurate. The concat demuxer uses durations to place following segments and chapter boundaries.
  • Chapter names are filenames instead of titles: the demuxer uses title metadata when present and falls back to filenames. Add suitable title metadata or author the chapter names in FFMETADATA.
  • Chapter navigation is absent in a player: inspect the output with ffprobe. If chapters are present, check whether the output container and target player expose them.
  • The long job is interrupted: retain separate downloads, use playlist-indexed filenames and yt-dlp’s download archive, and keep the manifest and metadata alongside the job. Resume or rebuild from the retained parts rather than relying on an incomplete final output.

Can yt-dlp concatenate the playlist instead?

yt-dlp documents --concat-playlist policies of never, always, or multi_video. Its concatenation constraints require matching codecs and stream counts; it should not be assumed to create the single master file with the intended chapter boundaries. If using it, separately inspect the result and add or verify chapter metadata as needed. See the yt-dlp video-selection documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Copyright and YouTube publication

Encoding and chaptering do not grant permission to republish playlist videos. Before downloading or publishing material, make sure you have the necessary rights and follow YouTube’s applicable copyright rules. If the finished video is intended for YouTube, chapter markers in the media file should not be treated as a substitute for checking the platform’s current chapter requirements or confirming how the uploaded video displays them.

Or let it run in the cloud

FFmpeg is for preparing a file on your own system. If your goal is to keep uploaded recordings looping as a YouTube live stream, StreamNeo is a separate cloud option: upload the recording or build a playlist, add your YouTube stream key, and go live. Your computer and home connection do not have to stay on; it streams uploaded videos to YouTube, not from a camera. Any uploaded quality up to 4K 60fps streams as made, at one flat price per slot. It can automatically recover if YouTube drops the stream. The first day is free with no card, one free day per account. Monthly: $9.99 per month.

Start your free StreamNeo day.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Screening Room

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.