So, I had a project that necessitated this, and found it wasn't directly possible. However, I came up with a workaround using FFMPEG, Python, and a batch script. This will only work on windows, but if you know a bit of coding, a macOS version shouldn't be too hard to figure out.
Scripts are at the bottom of this post, here's the steps for how to make it happen:
First is to properly set up your markers. Note that this only works with sequence markers (ones made on a timeline while no clips were selected), not markers on individual clips. If you want your marker names to be visible in VLC as chapter names when you play the file back (e.g. "Start of Concert"), you need to put the chapter names in the "description" area of the marker, not the title. I don't know why this is, but Premiere only exports descriptions, not the titles. If your markers don't have descriptions, they will simply be named "Chapter 1, Chapter 2, etc." in the end result
Second step is to go to your sequence and select "Show Audio Time Units" inside your sequence's hamburger menu within the timeline panel.
Image demonstration here
Next, right click the time code, and chose "milliseconds" instead of "audio samples"
Then go to File > Export > Markers, and choose Text File (.txt), and the same output destination as where your video file is. Make sure your .txt file is the same name as your video file (e.g., Video1.mp4, Video1.txt)
Now, onto the script itself, which requires Python3 and FFmpeg to be installed. If you haven't already registered FFmpeg on the command line globally and don't want to bother figuring that out, simply put FFmpeg.exe in the same folder as your video and text files.
Once those things are installed and everything's in the same folder, just drag/drop all the video files onto the .bat file. This will iterate through all of them, and make new files called something like Video1-chapters.mp4 Note that if you uncomment the last two lines of the batch script (removing "REM"), it will replace the original file instead of creating a new one.
And that's it!
Note that this is designed for .mp4 files, but may also work with other containers like .mov that allow chapters. Haven't tested, so I don't know.
~~~~~~~
Copy/paste these scripts into new files along with the file names I specified. Specifically, the python script needs to be named prpro_ffmpeg_chap.py or the batch script won't work.
Drop Video Files Here To Add Chapters.bat
prpro_ffmpeg_chap.pyCode:@echo off FOR %%A IN (%*) DO ( echo %%~nxA ffmpeg -i "%%~nxA" -f ffmetadata FFMETADATAFILE -loglevel warning -stats python3 "prpro_ffmpeg_chap.py" "%%~nA" echo If Python gave you an error message, remember to change echo Premiere Pro's time units to Milliseconds, not frames or samples echo before you export your markers. ffmpeg -i "%%~nxA" -i FFMETADATAFILE -map_metadata 1 -codec copy "%%~nA-chapters%%~xA" -loglevel warning -stats del FFMETADATAFILE REM del %%~nxA REM ren %%~nA-chapters.mp4 %%~nxA ) pause
Credit to iKyle at his blog for his original script, which I modified to work specifically with the way Premiere exports markers. Check out that blog post for a more in-depth explanation of how this works.Code:import re import math import sys chapters = list() loopnum = int(0) with open(sys.argv[1]+'.txt', 'r', encoding='utf=16') as f: next(f) for line in f: x = re.search(r".*?\t\t\t(\d{2}):(\d{2}):(\d{2}).(\d{3})\t{3}(.*?)\t", line) hrs = int(x.group(1)) mins = int(x.group(2)) secs = int(x.group(3)) ms = int(x.group(4)) desc = str(x.group(5)) loopnum += 1 if len(desc) > 0: title = x.group(5) else: title = "Chapter " + str(loopnum) minutes = (hrs * 60) + mins seconds = secs + (minutes * 60) timestamp = ms + (seconds * 1000) chap = { "title": title, "startTime": timestamp } chapters.append(chap) text = "" for i in range(len(chapters)-1): chap = chapters[i] title = chap['title'] start = chap['startTime'] end = chapters[i+1]['startTime']-1 text += f""" [CHAPTER] TIMEBASE=1/1000 START={start} END={end} title={title} """ with open("FFMETADATAFILE", "a") as myfile: myfile.write(text)
EDIT: Changed the code, as the original would not allow spaces in file names. Fixed!![]()
+ Reply to Thread
Results 1 to 1 of 1
-
Last edited by seanmcnally; 16th Nov 2021 at 18:49.
Similar Threads
-
LG BP350 not recognizing chapters from a mp4 or mkv file.
By DaveB69 in forum DVD RippingReplies: 10Last Post: 5th Nov 2020, 18:24 -
Renaming chapters in an mp4 from a text file
By RandmTask in forum Video ConversionReplies: 5Last Post: 24th Sep 2020, 04:06 -
Detecting Chapter Markers inside MP4 file
By SFD1968 in forum Newbie / General discussionsReplies: 3Last Post: 27th Dec 2018, 17:36 -
Adding Chapters To Mp4 File
By wulf109 in forum Video ConversionReplies: 5Last Post: 6th Sep 2017, 21:35 -
2 questions , can't import mov file inside premiere cc and about free prese
By rama in forum EditingReplies: 22Last Post: 19th Apr 2017, 00:12