With upcoming changes to data protection and privacy laws in Europe coming into effect soon, we thought this would be a good time to remind everyone that we do have a privacy policy.
This applies to all users and visitors world-wide.

We have made a few changes to the language to make it clearer in relation to this new regulation but fundamentally, the terms and your rights are unchanged.

If you have any questions about this, please feel free to ask in the General Forum

HandbrakeCLI Script not working

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
baron164
Posts: 2
Joined: Sat Feb 24, 2018 4:38 pm

HandbrakeCLI Script not working

Post by baron164 » Sat Feb 24, 2018 5:09 pm

I am trying to run a HandBrakeCLI script to re-encode a folder full of tv show episodes. I am running this in Ubuntu 16.04.4.

This is my bash script:

RC="/drives/downloads/TVShows"
DEST="/drives/shows/x265-Out"
DEST_EXT=mkv
HANDBRAKE_CLI=HandBrakeCLI

for FILE in "$SRC"/*
do
filename=$(basename "$FILE")
extension=${filename##*.}
filename=${filename%.*}
$HANDBRAKE_CLI -i "$FILE" -o "$DEST"/"$filename".$DEST_EXT
done

And this is the command I'm running:
./transcode.sh --preset-import-file /drives/shared/scripts/x265TV.json

And this is what I'm getting, the script gets hung and stops after saying "Header Missing". I'm at a loss at what the issue is.

[11:29:05] hb_init: starting libhb thread
[11:29:05] thread 7f40d0a1c700 started ("libhb")
HandBrake 1.0.4 (2017040900) - Linux x86_64 - https://handbrake.fr
8 CPUs detected
Opening /bin...
[11:29:05] CPU: Quad-Core AMD Opteron(tm) Processor 2384
[11:29:05] - logical processor count: 8
[11:29:05] hb_scan: path=/bin, title_index=1
disc.c:352: error opening file BDMV/index.bdmv
disc.c:352: error opening file BDMV/BACKUP/index.bdmv
[11:29:05] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 5.0.1
libdvdread: Encrypted DVD support unavailable.
libdvdread: Couldn't find device name.
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
[11:29:05] dvd: not a dvd - trying as a stream/file instead
[11:29:05] batch: scanning /bin/bash
Scanning title 1 of 1, 0.00 %[mp3 @ 0x7f40c8008240] Header missing
[mp3 @ 0x7f40c8008240] Header missing
Input #0, mp3, from '/bin/bash':
Duration: 00:02:09.69, start: 0.000000, bitrate: 64 kb/s
Stream #0:0: Audio: mp1
48000 Hz, 2 channels, s16p, 64 kb/s
[11:29:05] hb_stream_open: open /bin/bash failed
[11:29:05] libhb: scan thread found 0 valid title(s)
No title found.

HandBrake has exited.
[11:29:06] hb_init: starting libhb thread
[11:29:06] thread 7fd39e8a4700 started ("libhb")
HandBrake 1.0.4 (2017040900) - Linux x86_64 - https://handbrake.fr
8 CPUs detected
Opening /boot...
[11:29:06] CPU: Quad-Core AMD Opteron(tm) Processor 2384
[11:29:06] - logical processor count: 8
[11:29:06] hb_scan: path=/boot, title_index=1
disc.c:352: error opening file BDMV/index.bdmv
disc.c:352: error opening file BDMV/BACKUP/index.bdmv
[11:29:06] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 5.0.1
libdvdread: Encrypted DVD support unavailable.
libdvdread: Couldn't find device name.
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
[11:29:06] dvd: not a dvd - trying as a stream/file instead
[11:29:06] batch: scanning /boot/System.map-4.4.0-116-generic
[11:29:06] hb_stream_open: open /boot/System.map-4.4.0-116-generic failed
[11:29:06] libhb: scan thread found 0 valid title(s)
No title found.

HandBrake has exited.
[11:29:06] hb_init: starting libhb thread
[11:29:06] thread 7f5a8ea9d700 started ("libhb")
HandBrake 1.0.4 (2017040900) - Linux x86_64 - https://handbrake.fr
8 CPUs detected
Opening /dev...
[11:29:06] CPU: Quad-Core AMD Opteron(tm) Processor 2384
[11:29:06] - logical processor count: 8
[11:29:06] hb_scan: path=/dev, title_index=1
disc.c:352: error opening file BDMV/index.bdmv
disc.c:352: error opening file BDMV/BACKUP/index.bdmv
[11:29:06] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 5.0.1
libdvdread: Encrypted DVD support unavailable.
libdvdread: Attempting to use device udev mounted on /dev for CSS authentication
libdvdread: Could not open input: No such file or directory
libdvdread: Can't open udev for reading
libdvdread: Device udev 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
[11:29:06] dvd: not a dvd - trying as a stream/file instead
[11:29:06] batch: scanning /dev/core
[mp3 @ 0x7f5a88003f40] Header missing
[mp3 @ 0x7f5a88003f40] Header missing
[mp3 @ 0x7f5a88003f40] Header missing
[mp3 @ 0x7f5a88003f40] Header missing
Scanning title 1 of 1, 0.00 %

At this point the process hangs and I need to kill the script. If I run a straight HandbrakeCLI command it works fine and I can transcode individual files.

rollin_eng
Veteran User
Posts: 2759
Joined: Wed May 04, 2011 11:06 pm

Re: HandbrakeCLI Script not working

Post by rollin_eng » Sat Feb 24, 2018 6:49 pm

[11:29:05] batch: scanning /bin/bash

Are you sure it’s scanning the correct directory?

baron164
Posts: 2
Joined: Sat Feb 24, 2018 4:38 pm

Re: HandbrakeCLI Script not working

Post by baron164 » Sun Feb 25, 2018 2:35 am

D'oh!, looks like that was the issue, I took a few hours away from and when I looked back at the script I noticed that the very first line should have been "SRC" instead of just RC. I must have accidentally deleted the first character at some point and not noticed. I put fix that and boom it started working. And now I feel rather stupid, thank you.

Post Reply