How to find movie name with cli

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
shoubam
Posts: 4
Joined: Tue Aug 21, 2018 9:24 am

How to find movie name with cli

Post by shoubam »

Description of problem or question:

I would like to determine the movie name with the cli. My ideal outcome would be that the output file would have the name of the movie (and ideally the year, but I guess that is seperate problem). Currently I have to set the name manually, which is a problem for automated, headless ripping.

Is this featuer available? I guess it somehow is, because the gui can do it, just not the cli. Let me know if I should make that a feature request. Just wanted to ask in case I have overlooked something.


Steps to reproduce the problem (If Applicable):
HandBrakeCLI version 1.1.1 does not provide any options to determine the movie title.



HandBrake version (e.g., 1.0.0):
1.1.1



Operating system and version (e.g., Ubuntu 16.04 LTS, macOS 10.13 High Sierra, Windows 10 Creators Update):

Ubuntu Server 18.04

HandBrake Activity Log ***required*** (see How-to get an activity log)
N/A

Code: Select all

Please replace this text with the contents of your log file between the two code tags - OR -  provide a pastebin URL in place of these 3 lines.
Woodstock
Veteran User
Posts: 4614
Joined: Tue Aug 27, 2013 6:39 am

Re: How to find movie name with cli

Post by Woodstock »

The CLI isn't intended for that sort of mischief. Where are you expecting it to find such information?
shoubam
Posts: 4
Joined: Tue Aug 21, 2018 9:24 am

Re: How to find movie name with cli

Post by shoubam »

No Idea, thats why I am asking :)
I see that the gui gets this kind of information from somewhere, so there must be a way to grammatically determine this information. If the gui can do it, at least in my understanding it should be possible for the cli to acquire that same information.
rollin_eng
Veteran User
Posts: 4840
Joined: Wed May 04, 2011 11:06 pm

Re: How to find movie name with cli

Post by rollin_eng »

The GUI defaults to the file input name, is that what you mean?
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: How to find movie name with cli

Post by JohnAStebbins »

The title is sometimes available depending on the source. BD and DVD often (but not always) store the title in the volume info. Other formats often have the title in metadata tags. The CLI doesn't show this by default, but there is a "--json" option that outputs status information including the full title details in json. The title you are looking for is in the "Name" element of each "TitleList" item in the "Title Set". The year is not available for BD and DVD sources. But for other sources, the year is sometimes stored in the "Metadata".
shoubam
Posts: 4
Joined: Tue Aug 21, 2018 9:24 am

Re: How to find movie name with cli

Post by shoubam »

Thank you, JohnAStebbins. I was not able to find the items you mention in the output, however I did find the title in the output of HandBrakeCLI (makes me feel stupid now that I did not look there). libdvdread reads that title.

The following is a total hack, but works for me:

Code: Select all

HandBrakeCLI --scan  -i /dev/sr0 | awk -F: '/DVD Title/ {print $3}' |python -c "import sys; print(sys.stdin.read().title().replace('_', ' '))" |head -1
Problem solved.
Post Reply