Extract chapter names to a text file?
What is the command to extract all of the chapter names from a video and then have them saved in a text file? I only want each chapter name, one name per line, and nothing else. Thanks, Craig Sent from Yahoo Mail on Android
On Dec 3, 2022, at 3:26 PM, MyCraigs List via ffmpeg-user <ffmpeg-user@ffmpeg.org> wrote:
What is the command to extract all of the chapter names from a video and then have them saved in a text file? I only want each chapter name, one name per line, and nothing else. Thanks, Craig
Hi Craig, Because you didn’t get a response that I’m aware of, I’m sending one. This might include the information you want in its output file, but you may need to otherwise process the output to format it as you described. (Use “-y” if you don’t mind overwriting “chapters.txt”.) ffmpeg -y -loglevel error -i input -f ffmetadata chapters.txt L. Lee
This might include the information you want in its output file, but you may need to otherwise process the output to format it as you described. (Use “-y” if you don’t mind overwriting “chapters.txt”.)
ffmpeg -y -loglevel error -i input -f ffmetadata chapters.txt
L. Lee
If you are able to generate “chapters.txt” but observe an overabundance of information in that file, you might try the options that I used to get just the video title and a list of the chapters. Download match.pl (it appears in text on the page, just copy it using your browser) from http://noahdavids.org/self_published/match.html <http://noahdavids.org/self_published/match.html> and make it executable on your system. Then run this command: perl match.pl -match title -file chapters.txt | perl -pe 's/title=//s’ I’m sure there are perl savvy subscribers to this list who know how to yield the same results while bypassing match.pl, but match.pl seemed useful to me. L. Lee
On 12/5/2022 1:36 PM, Laine wrote:
If you are able to generate “chapters.txt” but observe an overabundance of information in that file, you might try the options that I used to get just the video title and a list of the chapters.
'grep' does wonders for pulling info out of files grep '^title=' chapters.txt (return all lines that start with "title=") all *nix and the mac should have grep, windoze doesn't unless you installed it yourself Or use mediainfo, which allows you to easily specify what data you want and how it's formatted. z!
On Dec 5, 2022, at 6:10 PM, Carl Zwanzig <cpz@tuunq.com> wrote:
On 12/5/2022 1:36 PM, Laine wrote:
If you are able to generate “chapters.txt” but observe an overabundance of information in that file, you might try the options that I used to get just the video title and a list of the chapters.
'grep' does wonders for pulling info out of files grep '^title=' chapters.txt
(return all lines that start with "title=") all *nix and the mac should have grep, windoze doesn't unless you installed it yourself
Or use mediainfo, which allows you to easily specify what data you want and how it's formatted.
z!
Thanks! And the following appears to remove “title=“ from lines generated by "grep '^title=‘ chapters.txt” alone. grep '^title=' chapters.txt | perl -pe 's/title=//s’ L. Lee
On 12/5/2022 4:20 PM, Laine wrote:
And the following appears to remove “title=“ from lines generated by "grep '^title=‘ chapters.txt” alone.
grep '^title=' chapters.txt | perl -pe 's/title=//s’
I'm not clear you you'd use perl at all when sed is more common for this sort of thing (sed 's/title=//’), but whatever works for you. z!
On 12/5/2022 4:30 PM, Carl Zwanzig wrote:
On 12/5/2022 4:20 PM, Laine wrote:
And the following appears to remove “title=“ from lines generated by "grep '^title=‘ chapters.txt” alone.
grep '^title=' chapters.txt | perl -pe 's/title=//s’
I'm not clear you you'd use perl at all when sed is more common for this sort of thing (sed 's/title=//’), but whatever works for you.
If it were me, I'd also add a '^' to anchor the regular expression (regexp) to the beginning of the line, as in 's/^title=//', just on the off chance the string "title=" appears in a chapter name. That'll work in sed or perl. And in the perl regexp, the 's' at the end isn't needed there (only changes how the '.' character is processed). And if you copy and paste from the above, note that those curly quotes should be straight quotes. Putting that all together: grep '^title=' chapters.txt | perl -pe 's/^title=//' or: grep '^title=' chapters.txt | sed 's/^title=//' -- Dan Harkless http://harkless.org/dan/
Am 06.12.2022 um 01:10 schrieb Carl Zwanzig:
On 12/5/2022 1:36 PM, Laine wrote:
If you are able to generate “chapters.txt” but observe an overabundance of information in that file, you might try the options that I used to get just the video title and a list of the chapters.
'grep' does wonders for pulling info out of files grep '^title=' chapters.txt
(return all lines that start with "title=") all *nix and the mac should have grep, windoze doesn't unless you installed it yourself
In Windows you can pipe the console output to "findstr". In my book is an example in chapter 8: http://www.astro-electronic.de/FFmpeg_Book.pdf Michael
Sorry for the delay in replying. Your suggestion worked perfectly. Thanks, Craig On Monday, December 5, 2022 at 04:37:31 AM EST, Laine <llee040@sbcglobal.net> wrote: On Dec 3, 2022, at 3:26 PM, MyCraigs List via ffmpeg-user <ffmpeg-user@ffmpeg.org> wrote:
What is the command to extract all of the chapter names from a video and then have them saved in a text file? I only want each chapter name, one name per line, and nothing else. Thanks, Craig
Hi Craig, Because you didn’t get a response that I’m aware of, I’m sending one. This might include the information you want in its output file, but you may need to otherwise process the output to format it as you described. (Use “-y” if you don’t mind overwriting “chapters.txt”.) ffmpeg -y -loglevel error -i input -f ffmetadata chapters.txt L. Lee _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
participants (5)
-
Carl Zwanzig -
Dan Harkless -
Laine -
Michael Koch -
MyCraigs List