Closed CallumKerson closed 9 years ago
Callum,
Thanks for the report. Sorry it's failing like that. I'm trying to get a VirtualBox install of Windows 7 up and running so I can reproduce this.
You are a star. Thanks so much. Let me know if you need any more from me.
Well, I may have to buy a PC because VirtualBox keeps locking up on me. :/
This may take awhile.
Ugh. I've spent the last three hours waiting for Windows 7 to updated itself. Can't do anything until it's done. This reminds me why I use OS X. :/
I've got a Win7 SP1 x64 VMware VM handy. I could try to reproduce the issue if you like.
Oh, thank you, @commandtab! Please, yes, oh please!
On it.
Current status: Going to get a drink while ffmpeg builds.
Excellent! That better be good wine. :)
Alright, I think I've got everything set up, but when I run transcode-video ~/title.mkv
, I get:
transcode-video: scanning media title 1 failed
Same output for detect-crop
. @donmelton Do you recognize that as a script issue, HandBrake issue, or something else entirely?
Interesting, this little hangup may be the result of an issue with HandBrakeCLI. Using the simplest of HandBrakeCLI (0.10.1) commands, it won't recognize any formats. Here I'm attempting to encode an MKV of a DVD using the MPEG-4/AAC defaults:
$ HandBrakeCLI.exe -i ~/POSV.mkv -o ~/POSV.mp4
[06:42:54] hb_init: starting libhb thread
HandBrake 0.10.1 (2015030800) - MinGW x86_64 - https://handbrake.fr
1 CPU detected
Opening /home/Owner/POSV.mkv...
[06:42:54] CPU: Intel(R) Core(TM) i7-4960HQ CPU @ 2.60GHz
[06:42:54] - Intel microarchitecture Haswell
[06:42:54] - logical processor count: 1
[06:42:54] OpenCL: library not available
[06:42:54] Intel Quick Sync Video support: no
[06:42:54] hb_scan: path=/home/Owner/POSV.mkv, title_index=1
libbluray/bdnav/index_parse.c:162: indx_parse(): error opening /home/Owner/POSV.mkv/BDMV/index.bdmv
libbluray/bdnav/index_parse.c:162: indx_parse(): error opening /home/Owner/POSV.mkv/BDMV/BACKUP/index.bdmv
libbluray/bluray.c:2182: nav_get_title_list(/home/Owner/POSV.mkv) failed
[06:42:54] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 5.0.1
libdvdread: Encrypted DVD support unavailable.
libdvdread: Can't stat /home/Owner/POSV.mkv
No such file or directory
libdvdread: Could not open /home/Owner/POSV.mkv
libdvdnav: vm: failed to open/read the DVD
[06:42:54] dvd: not a dvd - trying as a stream/file instead
[06:42:54] hb_stream_open: open /home/Owner/POSV.mkv failed
[06:42:54] scan: unrecognized file type
[06:42:54] libhb: scan thread found 0 valid title(s)
No title found.
HandBrake has exited.
I can get it to start transcoding with the Handbrake CLI as above. The issue you have to watch out for with this stuff it paths. If you are passing it a path like ~/POSV.mkv
then the windows Handbrake CLI exe doesn't know what to do with it. I'm not completely sure of the way around it, but I pass it a path to my network share that is the same in both Windows and Unix, like //192.168.1.16/Nalthis/Media/Videos/Archive/Princess Mononoke 1997.mkv
. The scripts AND handbrake will recognize such a path.
Ok I have found the line where the problem comes from
It is trying to find the duration from the scan command, which is at
It is trying to construct the command using the following code:
begin
IO.popen([
HandBrake.command_name,
"--title=#{title}",
'--scan',
"--previews=#{previews}:0",
"--input=#{path}"
], :err=>[:child, :out])
I have constructed a similar command myself, using
HandBrakeCLI --title=#1 --scan --input="//192.168.1.16/Nalthis/Media/Videos/Archive/Princess Mononoke 1997.mkv"
and this works! I get a duration out of it, Duration: 02:13:21.99. The full output of that command is below. So I do not beleive it to be a Handbrake problem. Either the output is not being parsed properly for that duration information, or the code is hitting line 74 without doing the scan method.
I believe it may be the latter option, as line 273 in the scan method has the statement Console.info "Scanning #{label} with HandBrakeCLI..."
and I do not see any such output when I run the scripts.
Hope this is helpful.
$ HandBrakeCLI --title=#1 --scan --input="//192.168.1.16/Nalthis/Media/Videos/Archive/Princess Mononoke 1997.mkv"
[10:00:54] hb_init: starting libhb thread
HandBrake svn6963 (2015030401) - MinGW x86_64 - https://handbrake.fr
4 CPUs detected
Opening //192.168.1.16/Nalthis/Media/Videos/Archive/Princess Mononoke 1997.mkv...
[10:00:54] CPU: AMD Phenom(tm) II X4 960T Processor
[10:00:54] - logical processor count: 4
[10:00:54] OpenCL device #1: Advanced Micro Devices, Inc. Barts
[10:00:54] - OpenCL version: 1.2 AMD-APP (1445.5)
[10:00:54] - driver version: 1445.5 (VM)
[10:00:54] - device type: GPU
[10:00:54] - supported: YES
[10:00:54] Intel Quick Sync Video support: no
[10:00:54] hb_scan: path=//192.168.1.16/Nalthis/Media/Videos/Archive/Princess Mononoke 1997.mkv, title_index=0
libbluray/bdnav/index_parse.c:162: indx_parse(): error opening //192.168.1.16/Nalthis/Media/Videos/Archive/Princess Mononoke 1997.mkv/BDMV/index.bdmv
libbluray/bdnav/index_parse.c:162: indx_parse(): error opening //192.168.1.16/Nalthis/Media/Videos/Archive/Princess Mononoke 1997.mkv/BDMV/BACKUP/index.bdmv
libbluray/bluray.c:2182: nav_get_title_list(//192.168.1.16/Nalthis/Media/Videos/Archive/Princess Mononoke 1997.mkv) failed
[10:00:54] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 5.0.1
libdvdread: Encrypted DVD support unavailable.
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[10:00:54] dvd: not a dvd - trying as a stream/file instead
Input #0, matroska,webm, from '//192.168.1.16/Nalthis/Media/Videos/Archive/Princess Mononoke 1997.mkv':
Duration: 02:13:21.99, start: 0.000000, bitrate: N/A
Chapter #0.0: start 0.000000, end 450.533417
Metadata:
title : Chapter 00
Chapter #0.1: start 450.533417, end 746.746000
Metadata:
title : Chapter 01
Chapter #0.2: start 746.746000, end 851.308792
Metadata:
title : Chapter 02
Chapter #0.3: start 851.308792, end 1126.875750
Metadata:
title : Chapter 03
Chapter #0.4: start 1126.875750, end 1271.311708
Metadata:
title : Chapter 04
Chapter #0.5: start 1271.311708, end 1392.432708
Metadata:
title : Chapter 05
Chapter #0.6: start 1392.432708, end 1533.365167
Metadata:
title : Chapter 06
Chapter #0.7: start 1533.365167, end 1728.351625
Metadata:
title : Chapter 07
Chapter #0.8: start 1728.351625, end 1973.846875
Metadata:
title : Chapter 08
Chapter #0.9: start 1973.846875, end 2183.389542
Metadata:
title : Chapter 09
Chapter #0.10: start 2183.389542, end 2656.612292
Metadata:
title : Chapter 10
Chapter #0.11: start 2656.612292, end 3250.497250
Metadata:
title : Chapter 11
Chapter #0.12: start 3250.497250, end 3479.142333
Metadata:
title : Chapter 12
Chapter #0.13: start 3479.142333, end 4063.851458
Metadata:
title : Chapter 13
Chapter #0.14: start 4063.851458, end 4361.482125
Metadata:
title : Chapter 14
Chapter #0.15: start 4361.482125, end 4714.000958
Metadata:
title : Chapter 15
Chapter #0.16: start 4714.000958, end 5069.189125
Metadata:
title : Chapter 16
Chapter #0.17: start 5069.189125, end 5243.488250
Metadata:
title : Chapter 17
Chapter #0.18: start 5243.488250, end 5602.930667
Metadata:
title : Chapter 18
Chapter #0.19: start 5602.930667, end 5913.991417
Metadata:
title : Chapter 19
Chapter #0.20: start 5913.991417, end 6340.208875
Metadata:
title : Chapter 20
Chapter #0.21: start 6340.208875, end 7049.709333
Metadata:
title : Chapter 21
Chapter #0.22: start 7049.709333, end 7532.316458
Metadata:
title : Chapter 22
Chapter #0.23: start 7532.316458, end 7710.494458
Metadata:
title : Chapter 23
Chapter #0.24: start 7710.494458, end 8001.994000
Metadata:
title : Chapter 24
Stream #0.0(eng): Video: h264 (High), yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 23.98 fps, 1k tbn, 47.95 tbc
Stream #0.1(jpn): Audio: flac, 48000 Hz, 5.1, s16 (default)
Metadata:
title : Surround 5.1
Stream #0.2(eng): Subtitle: pgssub (default)
[10:00:55] dxva2:IDirect3D9_GetAdapterIdentifier failed
[10:00:55] dxva2:IDirect3D9_CreateDevice failed
[10:00:55] dxva2:Failed to create Direct3D device
[10:00:55] scan: decoding previews for title 1
Scanning title 1 of 1, preview 1, 0.00 %[10:00:55] scan: audio 0x1: flac, rate=48000Hz, bitrate=1 Japanese (FLAC) (5.1 ch)
Scanning title 1 of 1, preview 10, 100.00 %[10:00:56] scan: 10 previews, 1920x1080, 23.976 fps, autocrop = 22/22/0/0, aspect 16:9, PAR 1:1
Scanning title 1 of 1, preview 10, 100.00 %[10:00:56] libhb: scan thread found 1 valid title(s)
+ title 1:
+ stream: //192.168.1.16/Nalthis/Media/Videos/Archive/Princess Mononoke 1997.mkv
+ duration: 02:13:21
+ size: 1920x1080, pixel aspect: 1/1, display aspect: 1.78, 1.000 fps
+ autocrop: 22/22/0/0
+ support opencl: yes
+ support hwd: no
+ chapters:
+ 1: cells 0->0, 0 blocks, duration 00:07:31
+ 2: cells 0->0, 0 blocks, duration 00:04:56
+ 3: cells 0->0, 0 blocks, duration 00:01:45
+ 4: cells 0->0, 0 blocks, duration 00:04:36
+ 5: cells 0->0, 0 blocks, duration 00:02:24
+ 6: cells 0->0, 0 blocks, duration 00:02:01
+ 7: cells 0->0, 0 blocks, duration 00:02:21
+ 8: cells 0->0, 0 blocks, duration 00:03:15
+ 9: cells 0->0, 0 blocks, duration 00:04:05
+ 10: cells 0->0, 0 blocks, duration 00:03:30
+ 11: cells 0->0, 0 blocks, duration 00:07:53
+ 12: cells 0->0, 0 blocks, duration 00:09:54
+ 13: cells 0->0, 0 blocks, duration 00:03:49
+ 14: cells 0->0, 0 blocks, duration 00:09:45
+ 15: cells 0->0, 0 blocks, duration 00:04:58
+ 16: cells 0->0, 0 blocks, duration 00:05:53
+ 17: cells 0->0, 0 blocks, duration 00:05:55
+ 18: cells 0->0, 0 blocks, duration 00:02:54
+ 19: cells 0->0, 0 blocks, duration 00:05:59
+ 20: cells 0->0, 0 blocks, duration 00:05:11
+ 21: cells 0->0, 0 blocks, duration 00:07:06
+ 22: cells 0->0, 0 blocks, duration 00:11:50
+ 23: cells 0->0, 0 blocks, duration 00:08:03
+ 24: cells 0->0, 0 blocks, duration 00:02:58
+ 25: cells 0->0, 0 blocks, duration 00:04:51
+ audio tracks:
+ 1, Japanese (FLAC) (5.1 ch) (iso639-2: jpn)
+ subtitle tracks:
+ 1, English (iso639-2: eng) (Bitmap)(PGS)
HandBrake has exited.
@commandtab Thanks so much for doing all that setup work! Sorry I didn't comment last night but I collapsed in bed at about 10:30 here in California. Looks like you're reproducing the same problem, or something very similar, that @CallumKerrEdwards is having.
Based on all the data from both of you, I would say the bug is somewhere in my code, probably in parsing the scan output of HandBrakeCLI
in the media.rb
file. There's just something fundamental I'm doing that doesn't work on Windows. But I don't know what that could be yet.
OK, I have finally got enough of a Windows 7 installation working on VirtualBox to reproduce the "media duration not found" error. Let's see if I can figure this out...
Thank goodness! I was worried it was an environment issue on my box 😔 let me know if there is anything I can do.
Normally I'm the first guy to say "you can't beat free" but in this instance, I can't recommend Fusion enough. Use it everyday, and it hard-won my allegiance from Parallels and VB. Super fast and very stable.
@CallumKerrEdwards I never doubted you! It was me that I was worried about. :)
@peelman Good to know. Thanks for the recommendation. Fast is what I need.
Ugh. I now know what the problem is and it's systemic. Ruby isn't recognizing DOS-style line feeds in regular expressions. :(
And it gets worse, too. :( The behavior of Cygwin and MinGW-based standalone Ruby installer are different.
OK, I'm slowly figuring out a patch for this. This could take awhile, but stay tuned...
Ugh, Cygwin is particularly stupid about handling $
in regular expressions when parsing input with DOS-style line endings. MingGW doesn't have this problem.
This means I'll have to change code in query-handbrake-log
too. Just shoot me.
God-willing I don't have to change any of the command line option parsing code!
The good news is that preliminary testing indicates my patch to media.rb
doesn't break transcode-video
on OS X.
So I've got that going for me. Which is nice.
@CallumKerrEdwards Good call on the paths! I'm able to use the method you suggested and am now able to reproduce the issue. So, I'm in a position to test a fix as well :)
@commandtab Sweet! I'll have something to text for y'all in (hopefully) about an hour or so.
My only problem is that I ran into a completely new bug (not Windows-related) while doing testing. Dammit. :)
OK, just checked in the fix! Whew! :)
As soon as I fix this other damn bug I'll push a new Gem. Stay tuned...
@CallumKerrEdwards and @commandtab The Gem has been pushed! Please test and let me know if this is fixed.
Thanks for all your help on this one!
I'll close this now but I'll re-open it if the bug is still happening for either of you.
Verified!
@CallumKerrEdwards Hot damn! Now I'm can get some sleep tonight. :)
Thanks again!
Description
Whenever I try to transcode any mkv file, it parses the parameters, then the following message is printed out.
This happens regardless of the parameters or input files. It happens for all kinds of mkv inputs. I cannot find an mkv that works.
Environment