CLI Chapter Points

Discussion of the HandBrake command line interface (CLI)
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
ssj2_goha
Enlightened
Posts: 110
Joined: Wed Jul 25, 2007 7:55 am

CLI Chapter Points

Post by ssj2_goha »

How do you name chapter points with the cli?

If there is another thread discussing this just point me too that one and sorry in advance if this is a double post.
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Post by jbrjake »

By making a comma separated values text file and feeding it in as the argument to -m.

Cyander never documented it, but I'd imagine the format is

01,Chapter Name

or
Chapter Name,01
ssj2_goha
Enlightened
Posts: 110
Joined: Wed Jul 25, 2007 7:55 am

Post by ssj2_goha »

Ok thanks i will try both and report what happens.
jona
Posts: 13
Joined: Tue Jun 19, 2007 3:53 am

Post by jona »

Has anyone got this to work?
I've tried a lot of different options ...
  • - Chapter Name
    - 1,Chapter Name
    - 01,Chapter Name
    - 001,Chapter Name
    - Chapter 1,Chapter Name
    - Chapter 01,Chapter Name
    - Chapter 001,Chapter Name
    - Chapter Name,,01
I've also tried
  • - reversing the 2 fields on the above combinations,
    - putting quotes around each field on the above combinations
    - escaping spaces with \ (Chapter\ Name)
but nothing is working so far ... does anyone know how this .CSV file is supposed to work? I've tried searching the forums, but can't come up with anything (sorry if this is a double post).

I'm using Mac OS X.4.11 with HandbrakeCLI 0.9.1

Thanks
User avatar
s55
HandBrake Team
Posts: 10357
Joined: Sun Dec 24, 2006 1:05 pm

Post by s55 »

Did some investigating and it turns out the feature is broken on the CLI.

A fix is being worked on.
jona
Posts: 13
Joined: Tue Jun 19, 2007 3:53 am

Post by jona »

Thanks so much for your reply,
and thanks for all your hard work ... HandBrake is such a great app!
User avatar
s55
HandBrake Team
Posts: 10357
Joined: Sun Dec 24, 2006 1:05 pm

Post by s55 »

User avatar
s55
HandBrake Team
Posts: 10357
Joined: Sun Dec 24, 2006 1:05 pm

Post by s55 »

CSV should be formatted as follows

1,Chapter1
2,Chapter2
3,Chapter3

etc

and is used

--markers=file.csv
jona
Posts: 13
Joined: Tue Jun 19, 2007 3:53 am

Post by jona »

Thanks for patching that so quickly Scott, that's awesome!
I downloaded and then compiled all of the most recent source, and it's reading nicely from my .CSV file.

However, I've found a bug with the most recent source which I wanted to point out to avoid it being overlooked before the next major release:

With the --markers option (whether or not a .CSV file is specified), I'm getting a "doubling of chapters" problem, similar to the one found in this thread: http://handbrake.m0k.org/forum/viewtopic.php?t=2760
The first chapter starts at 0:00, then after that, each chapter point has 2 chapter markers on it (ie: Chapters 2&3 both start where chapter 2 should be, Chapters 4&5 both start where chapter 3 should be etc.) - actually the pairs of chapter markers are 2 frames apart. I've reproduced this using a variety of DVDs.

Thanks for also pointing out the CLI syntax: --markers takes an '=' before the name of the .csv file. I don't know that that had been clearly stated elsewhere. Out of curiosity, I went back and tried that syntax on the 0.9.1 release, and it did work with my CSV file!

I wish I could be of assistance with the fixing of that bug I discovered. Is there somewhere else I should report it? I'm not really looking for support for a pre-release build (I'll just keep using 0.9.1 till an official release is out), but I do want to ensure that the bug doesn't make it through to the next official release.

Thanks again for all your hard work.
Last edited by jona on Thu Feb 07, 2008 9:50 am, edited 1 time in total.
User avatar
s55
HandBrake Team
Posts: 10357
Joined: Sun Dec 24, 2006 1:05 pm

Post by s55 »

I'm looking into this. I noticed the unusual behaviour last night myself.

Doing some testing now.
jona
Posts: 13
Joined: Tue Jun 19, 2007 3:53 am

Post by jona »

Great, thanks :D
Raven096
Posts: 3
Joined: Wed Feb 06, 2008 8:18 pm

Re: CLI Chapter Points

Post by Raven096 »

I'm not having the double chapter issue, but I am having an issue with "," commas in the chapter name getting cut off. Is there a way to get around this? I've tried a couple of different ways but it still cuts off at the additional commas in the chapter name itself.
User avatar
s55
HandBrake Team
Posts: 10357
Joined: Sun Dec 24, 2006 1:05 pm

Re: CLI Chapter Points

Post by s55 »

use something other than a comma? The comma is used for the spliting of data.
Raven096
Posts: 3
Joined: Wed Feb 06, 2008 8:18 pm

Re: CLI Chapter Points

Post by Raven096 »

sr55 wrote:use something other than a comma? The comma is used for the spliting of data.
Trust me I thought of that, but I didn't want to have semicolon in the middle of the title, just looks funny when I look at it. I was hoping for some type of double quote "" ,"" or the like to allow the comma. Also, I understand that the chapter file is a CSV, but realistically there is only a need for one comma per line. With this in mind something like:


1,Intro
2,Hello, world

would result something like

Chapter 1 = Intro
Chapter 2 = Hello, world


But, I'll have to admit I am one of those that wants the world even if I don't deserve it. I stumbled across this application and think its fantastic!
dynaflash
Veteran User
Posts: 3820
Joined: Thu Nov 02, 2006 8:19 pm

Re: CLI Chapter Points

Post by dynaflash »

try escaping your comma with "\" ( dont use the quotes) see how that works.
jona
Posts: 13
Joined: Tue Jun 19, 2007 3:53 am

Re: CLI Chapter Points

Post by jona »

use this on the command-line:
--markers=FILENAME.csv

and format the .csv as:
1,Intro
2,Hello\, world
3,All about backslashes \\

\ is used to escape commas and backslashes. I can confirm that this works.
Raw UTF-8 encoding also works.
Raven096
Posts: 3
Joined: Wed Feb 06, 2008 8:18 pm

Re: CLI Chapter Points

Post by Raven096 »

jona wrote:use this on the command-line:
--markers=FILENAME.csv

and format the .csv as:
1,Intro
2,Hello\, world
3,All about backslashes \\

\ is used to escape commas and backslashes. I can confirm that this works.
Raw UTF-8 encoding also works.

I don't know why this didn't occur to me, but it worked like a champ. Thanks
jona
Posts: 13
Joined: Tue Jun 19, 2007 3:53 am

Re: CLI Chapter Points

Post by jona »

Raven096 wrote:I don't know why this didn't occur to me, but it worked like a champ. Thanks
No problem!
BurkDP
Posts: 12
Joined: Sat Mar 01, 2008 6:19 am

Re: CLI Chapter Points

Post by BurkDP »

I know that compiling the latest dev release is "at your own risk", and I'm not complaining, but with the last few revisions since 0.9.2 I couldn't seem to get the Linux (or mac for that matter - tested myself to see if it was a *nix quirk) CLI to read chapter marker files.

-Version: svn revision 1322
-Date of download: Mar 1, 2008
-Platform: Ubuntu 7.10 amd64
-DVD title: Fullmetal Alchemist Conqueror of Shamballa
-Settings: ./HandBrakeCLI HandBrakeCLI -i ~/CONQUEROR_OF_SHAMBALLA -L -c 1-21 -o ~/ipod/fullmetal_alchemist_conqueror_of_shamballa.m4v --preset="iPod High-Rez" -s 2 --markers=~/hbchapters/fmacos.csv --deinterlace=slower


+ Using preset: iPod High-RezReading chapter markers from file ~/Desktop/fmacos.csv
Cannot open chapter marker file, using defaults


But I appear to have gotten it working now (it hasn't given me the same error, but I haven't finished ripping yet). All I had to do was put the '--markers=' in front of the the '--preset=' argument. Also, that I needed to type the entire folder path, not use '~/' as a shortcut to my home directory...or it could've just been fixed by getting the latest update...or magic.

./HandBrakeCLI HandBrakeCLI -i ~/Bleach_DVDs/Bleach_Volume_9.iso -L -c 1-5 -o ~/videos/Bleach_33.m4v --markers=/home/danielburk/hbchapters/bleach.csv --preset="iPhone / iPod Touch" --deinterlace=slower

+ Using preset: iPhone / iPod TouchReading chapter markers from file /home/danielburk/hbchapters/bleach.csv


I know it's a different DVD & preset, but I did get the read .csv error when trying to rip Bleach or any other DVD so I assume it would fix the previous one as well. Keep up the amazing work on the phenomenal HandBrake.


P.S. Someone should update the CLI guide on the wiki to include using .csv files for chapter markers. I would but I'm more of an idea man... ;)
User avatar
s55
HandBrake Team
Posts: 10357
Joined: Sun Dec 24, 2006 1:05 pm

Re: CLI Chapter Points

Post by s55 »

Using HandBrakeCLI - updated for usage of CSV files.
Cyander
Experienced
Posts: 94
Joined: Tue Mar 20, 2007 9:19 pm

Re: CLI Chapter Points

Post by Cyander »

A note on the '--markers=' option:

I am not sure WHY it requires the '=' (I never used getopt before writing that code), but the really weird thing I could never figure out is why short-cuts like '~' never worked.

To the post 2 above mine, you have to use a strict relative, or absolute path. You can't use '~' escapes.
Post Reply