Page 1 of 1

Output to each video's separate folder

Posted: Tue Jun 14, 2016 11:24 pm
by Ross
Hi,
It's been a short time since I discovered HandBrake. I wish I've known for longer. Decent program!

I'm sure there's been many similar questions to this one, but I couldn't find this specific thing: using the CLI to convert each group of videos to their own output folder in Windows 10, HandBrake version 0.10.5.0 64b.

Example:

I have some dirs with videos taken from an iPhone camera:
* E:\Dropbox\Videos\From iPhone\Vacation 2013\many-from-2013.mov
* E:\Dropbox\Videos\From iPhone\Vacation 2014\many-from-2014.mov
* E:\Dropbox\Videos\From iPhone\Vacation 2015\many-from-2015.mov
They're all in 1920x1080 .mov format and take a lot of storage. I'd like to reduce them to 1280x720 and possibly reduce the framerate from 29 to 23.976, or whatever solution you can suggest me to reduce file size.

So I tried:

Code: Select all

HandBrakeCLI -v -i "E:\Dropbox\Videos\From iPhone\Vacation 2013\" -o "E:\Dropbox\Videos\From iPhone converted" -w 1280 -O -e x264 -q 22
But the above only applies to a single folder to be converted, so I have to wait and then modify the command to get to the next. What I want is to do be able to convert all of the above videos under any subdir of E:\Dropbox\Videos\From iPhone\, at once, and have this output:
* E:\Dropbox\Videos\From iPhone converted\Vacation 2013\many-from-2013.mp4
* E:\Dropbox\Videos\From iPhone converted\Vacation 2014\many-from-2014.mp4
* E:\Dropbox\Videos\From iPhone converted\Vacation 2015\many-from-2015.mp4
...so that none would overwrite the originals. How can I do it?

Obs. I didn't provide the encode log because the individual approaches I make are successful themselves, so it's not the point.

Re: Output to each video's separate folder

Posted: Wed Jun 15, 2016 7:17 pm
by Woodstock
You can use batch files to do this. They're simple to construct in any text editor (including notepad), and you can even edit them to add more lines while their running, so long as you don't make any changes prior to the currently-running command... I do it all the time. If you insert something like this in front of each line, you can even keep track of where it is:

Code: Select all

title "many-from-2013" & 
The CMD window title will show "many-from-2013" while the encode is running.

Re: Output to each video's separate folder

Posted: Wed Jun 15, 2016 8:54 pm
by mduell
Pretty easy to write a batch script to iterate through each file and set the output appropriately.

Encode logs can still be useful, regardless of your opinion. You'll note the header makes no exception for "unless you don't think so".

Re: Output to each video's separate folder

Posted: Wed Jun 15, 2016 9:34 pm
by rollin_eng
mduell wrote:Pretty easy to write a batch script to iterate through each file and set the output appropriately.
Perhaps you could post a working example?

Re: Output to each video's separate folder

Posted: Wed Jun 15, 2016 11:22 pm
by Woodstock
Searching for "script" gives too many hits here, but scrolling down through the CLI forum, there are a few that are "off the top page".

viewtopic.php?f=10&t=26163
viewtopic.php?f=10&t=28466
viewtopic.php?f=10&t=31537

There are more with "script" in the subject after you get past page 6.

Re: Output to each video's separate folder

Posted: Thu Jun 16, 2016 5:10 am
by Ross
Thanks for your responses!
Woodstock wrote:Searching for "script" gives too many hits here, but scrolling down through the CLI forum, there are a few that are "off the top page".

viewtopic.php?f=10&t=26163
viewtopic.php?f=10&t=28466
viewtopic.php?f=10&t=31537

There are more with "script" in the subject after you get past page 6.
I've seen those, actually two are the same, and none address the actual problem. They're about 'creating a script', but everything I've seen here is based on Unix-like OS'es and some bash scripts, which don't work on Windows. Also, one (two) of them require Ruby installed, and possibly would require Ruby knowledge if I were to make modifications :(
mduell wrote:Pretty easy to write a batch script to iterate through each file and set the output appropriately.

Encode logs can still be useful, regardless of your opinion. You'll note the header makes no exception for "unless you don't think so".
Apparently not, since, for each group of encodes, I'd have to modify the batch script. And sorry about not posting the log, I thought it wasn't exactly mandatory. I have the following, but nonetheless, it's pointless. See why:

To make things simpler, I've created a minimalistic test tree:
E:\test\source\vacation2013\2013 1.mov
E:\test\source\vacation2013\2013 2.mov
E:\test\source\vacation2013\2013 3.mov

E:\test\source\vacation2014\2014 1.mov
E:\test\source\vacation2014\2014 2.mov
E:\test\source\vacation2014\2014 3.mov

E:\test\source\vacation2015\2015 1.mov
E:\test\source\vacation2015\2015 2.mov
E:\test\source\vacation2015\2015 3.mov


The destination was supposed to be like...
E:\test\destination\vacation201[3-5] reduced\201[3-5] [1-3].mp4


Which is the same as...
E:\test\destination\vacation2013-reduced\2013 1.mp4
E:\test\destination\vacation2013-reduced\2013 2.mp4
E:\test\destination\vacation2013-reduced\2013 3.mp4

E:\test\destination\vacation2014-reduced\2014 1.mp4
E:\test\destination\vacation2014-reduced\2014 2.mp4
E:\test\destination\vacation2014-reduced\2014 3.mp4

E:\test\destination\vacation2015-reduced\2015 1.mp4
E:\test\destination\vacation2015-reduced\2015 2.mp4
E:\test\destination\vacation2015-reduced\2015 3.mp4


But if I simply run this...

Code: Select all

HandBrakeCLI -v -i "E:\test\source" -o "E:\test\destination\"


I get this:

Code: Select all

Output format can't be guessed from file name (E:\test\destination), using default.
[02:02:39] hb_init: starting libhb thread
HandBrake 0.10.5 (2016021100) - MinGW x86_64 - https://handbrake.fr
4 CPUs detected
Opening E:\test\source...
[02:02:39] CPU: Intel(R) Core(TM) i5-3450 CPU @ 3.10GHz
[02:02:39]  - Intel microarchitecture Ivy Bridge
[02:02:39]  - logical processor count: 4
[02:02:39] OpenCL device #1: Advanced Micro Devices, Inc. Capeverde
[02:02:39]  - OpenCL version: 1.2 AMD-APP (2004.6)
[02:02:39]  - driver version: 2004.6 (VM)
[02:02:39]  - device type:    GPU
[02:02:39]  - supported:      YES
[02:02:39] Intel Quick Sync Video support: no
[02:02:39] hb_scan: path=E:\test\source, title_index=1
libbluray/bdnav/index_parse.c:162: indx_parse(): error opening E:\test\source/BDMV/index.bdmv
libbluray/bdnav/index_parse.c:162: indx_parse(): error opening E:\test\source/BDMV/BACKUP/index.bdmv
libbluray/bluray.c:2182: nav_get_title_list(E:\test\source) failed
[02:02:39] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 5.0.1
libdvdread: Encrypted DVD support unavailable.
libdvdread: Could not open input: Permission denied
libdvdread: Can't open E:\test\source for reading
libdvdread: Device E:\test\source inaccessible, CSS authentication not available.
libdvdread:DVDOpenFilePath:findDVDFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdread:DVDOpenFilePath:findDVDFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[02:02:39] dvd: not a dvd - trying as a stream/file instead
[02:02:39] hb_stream_open: open E:\test\source failed
[02:02:39] scan: unrecognized file type
[02:02:39] libhb: scan thread found 0 valid title(s)
No title found.
HandBrake has exited.
Seems obvious, right? After all, I didn't use any options. But I don't see anything like a -r or -R option to "recurse" subdirectories so the program could find the .mov files inside. And, if I delve to the actual dir containing the .mov files, then the purpose of the opening question would be forfeit.

So, what could I do besides creating a specific script for each situation?

Re: Output to each video's separate folder

Posted: Fri Jun 24, 2016 6:30 am
by Ross
So, anyone? I don't see a way to circumvent the need for a -R option to recurse subdirectories... :(

Re: Output to each video's separate folder

Posted: Fri Jun 24, 2016 6:44 am
by rollin_eng
There is no -r option, if you want to search through directories and sub directories you will have to script it.

Re: Output to each video's separate folder

Posted: Sat Jun 25, 2016 9:24 am
by Ross
Thanks Rollin_eng.
That's sad to hear, because although one can make a script, it is not very nice to have to create a script for every batch job... :(

This could serve as a feature suggestion for the developers, though.

Re: Output to each video's separate folder

Posted: Sat Jun 25, 2016 9:35 am
by rollin_eng
There is a feature request forum, you could search it to see if this has been requested before.

You can script the CLI to do pretty much anything, including going through multiple folders/sub-folders.

If this is a one off project doing individual batches/folders may be the easiest way to go, if this is something you envision doing often then learning how to write a script to search through multiple folders might be the better option.

Re: Output to each video's separate folder

Posted: Mon Jul 04, 2016 2:45 pm
by Ross
Thanks rollin_eng!
I guess I'll try to script my way out.