While this issue happen, the scan is running for ever, without parsing anything more, after having meet ones of these only 2 M2TS files.
TRACE 2017-05-18 22:48:16.343 [Library Scanner] Matched format MPG to "F:\!MEDIA_TEST_FILES\UMS Video Testing Suite (20150121)\M2TS\AVS-HD1080-PCM.m2ts"
WARN 2017-05-18 22:48:16.890 [Library Scanner] Unhandled exception while resolving AVS-HD1080-PCM.m2ts: For input string: ""
DEBUG 2017-05-18 22:48:16.906 [Library Scanner]
java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at net.pms.dlna.LibMediaInfoParser.getPixelValue(LibMediaInfoParser.java:672)
at net.pms.dlna.LibMediaInfoParser.parse(LibMediaInfoParser.java:136)
at net.pms.configuration.FormatConfiguration.parse(FormatConfiguration.java:404)
at net.pms.formats.Format.parse(Format.java:310)
at net.pms.dlna.RealFile.resolve(RealFile.java:208)
at net.pms.dlna.DLNAResource.syncResolve(DLNAResource.java:1486)
at net.pms.dlna.DLNAResource.run(DLNAResource.java:1285)
at net.pms.dlna.RealFile.isValid(RealFile.java:71)
at net.pms.dlna.DLNAResource.addChild(DLNAResource.java:577)
at net.pms.dlna.DLNAResource.addChild(DLNAResource.java:537)
at net.pms.dlna.MapFile.manageFile(MapFile.java:113)
at net.pms.dlna.MapFile.analyzeChildren(MapFile.java:169)
at net.pms.dlna.RootFolder.scan(RootFolder.java:260)
at net.pms.dlna.RootFolder.scan(RootFolder.java:270)
at net.pms.dlna.RootFolder.scan(RootFolder.java:218)
at net.pms.dlna.DLNAMediaDatabase.run(DLNAMediaDatabase.java:938)
at java.lang.Thread.run(Unknown Source)
General
Count : 327
Count of stream of this kind : 1
Kind of stream : General
Kind of stream : General
Stream identifier : 0
ID : 0
ID : 0 (0x0)
Count of video streams : 1
Count of audio streams : 1
Video_Format_List : AVC
Video_Format_WithHint_List : AVC
Codecs Video : AVC
Audio_Format_List : PCM
Audio_Format_WithHint_List : PCM
Audio codecs : PCM
Complete name : C:\Documents and Settings\Philippe\Bureau\MediaInfo_CLI_0.7.95\AVS-HD1080-PCM.m2ts
Folder name : C:\Documents and Settings\Philippe\Bureau\MediaInfo_CLI_0.7.95
File name : AVS-HD1080-PCM
File extension : m2ts
Format : BDAV
Format : BDAV
Format/Info : Blu-ray Video
Format/Extensions usually used : m2ts mts ssif
Commercial name : BDAV
Codec : BDAV
Codec : BDAV
Codec/Info : Blu-ray Video
Codec/Extensions usually used : m2ts mts ssif
File size : 40442496
File size : 38.6 MiB
File size : 39 MiB
File size : 39 MiB
File size : 38.6 MiB
File size : 38.57 MiB
Duration : 11357.000000
Duration : 11 s 357 ms
Duration : 11 s 357 ms
Duration : 11 s 357 ms
Duration : 00:00:11.357
Duration : 00:00:11:10
Duration : 00:00:11.357 (00:00:11:10)
Overall bit rate mode : VBR
Overall bit rate mode : Variable
Overall bit rate : 28252554
Overall bit rate : 28.3 Mb/s
Frame rate : 24.000
Frame rate : 24.000 FPS
Frame count : 274
Stream size : 1734293
Stream size : 1.65 MiB (4%)
Stream size : 2 MiB
Stream size : 1.7 MiB
Stream size : 1.65 MiB
Stream size : 1.654 MiB
Stream size : 1.65 MiB (4%)
Proportion of this stream : 0.04288
File creation date : UTC 2017-05-18 21:39:36.920
File creation date (local) : 2017-05-18 23:39:36.920
File last modification date : UTC 2016-04-25 16:24:00.000
File last modification date (local) : 2016-04-25 18:24:00.000
OverallBitRate_Precision_Min : 28251310
OverallBitRate_Precision_Max : 28253799
Video
Count : 339
Count of stream of this kind : 1
Kind of stream : Video
Kind of stream : Video
Stream identifier : 0
StreamOrder : 0-0
ID : 4113
ID : 4113 (0x1011)
Menu ID : 1
Menu ID : 1 (0x1)
Format : AVC
Format/Info : Advanced Video Codec
Format/Url : http://developers.videolan.org/x264.html
Commercial name : AVC
Format profile : [email protected]
Format settings : CABAC / 2 Ref Frames
Format settings, CABAC : Yes
Format settings, CABAC : Yes
Format settings, ReFrames : 2
Format settings, ReFrames : 2 frames
Internet media type : video/H264
Codec ID : 27
Codec : AVC
Codec : AVC
Codec/Family : AVC
Codec/Info : Advanced Video Codec
Codec/Url : http://developers.videolan.org/x264.html
Codec profile : [email protected]
Codec settings : CABAC / 2 Ref Frames
Codec settings, CABAC : Yes
Codec_Settings_RefFrames : 2
Duration : 11417
Duration : 11 s 417 ms
Duration : 11 s 417 ms
Duration : 11 s 417 ms
Duration : 00:00:11.417
Duration : 00:00:11:10
Duration : 00:00:11.417 (00:00:11:10)
Bit rate : 25588892
Bit rate : 25.6 Mb/s
Width : 1920
Width : 1 920 pixels
Height : 1080
Height : 1 080 pixels
Stored_Height : 1088
Sampled_Width : 1920
Sampled_Height : 1080
Pixel aspect ratio : 1.000
Display aspect ratio : 1.778
Display aspect ratio : 16:9
Frame rate : 24.000
Frame rate : 24.000 FPS
Frame count : 274
Resolution : 8
Resolution : 8 bits
Colorimetry : 4:2:0
Color space : YUV
Chroma subsampling : 4:2:0
Chroma subsampling : 4:2:0
Bit depth : 8
Bit depth : 8 bits
Scan type : Progressive
Scan type : Progressive
Interlacement : PPF
Interlacement : Progressive
Bits/(Pixel*Frame) : 0.514
Delay : 1000.000
Delay : 1 s 0 ms
Delay : 1 s 0 ms
Delay : 1 s 0 ms
Delay : 00:00:01.000
Delay, origin : Container
Delay, origin : Container
Stream size : 36517483
Stream size : 34.8 MiB (90%)
Stream size : 35 MiB
Stream size : 35 MiB
Stream size : 34.8 MiB
Stream size : 34.83 MiB
Stream size : 34.8 MiB (90%)
Proportion of this stream : 0.90295
format_identifier : HDMV
Audio
Count : 276
Count of stream of this kind : 1
Kind of stream : Audio
Kind of stream : Audio
Stream identifier : 0
StreamOrder : 0-1
ID : 4352
ID : 4352 (0x1100)
Menu ID : 1
Menu ID : 1 (0x1)
Format : PCM
Commercial name : PCM
Format settings : Big / Signed
Format settings, Endianness : Big
Format settings, Sign : Signed
Muxing mode : Blu-ray
Codec ID : 128
Codec : PCM
Codec : PCM
Codec/Family : PCM
Codec settings : Big / Signed
Codec settings, Endianness : Big
Codec settings, Sign : Signed
Duration : 11410
Duration : 11 s 410 ms
Duration : 11 s 410 ms
Duration : 11 s 410 ms
Duration : 00:00:11.410
Duration : 00:00:11.410
Bit rate mode : CBR
Bit rate mode : Constant
Bit rate : 1536000
Bit rate : 1 536 kb/s
Channel(s) : 2
Channel(s) : 2 channels
Channel positions : Front: L R
Channel positions : 2/0/0.0
Sampling rate : 48000
Sampling rate : 48.0 kHz
Samples count : 547680
Resolution : 16
Resolution : 16 bits
Bit depth : 16
Bit depth : 16 bits
Delay : 1000.000
Delay : 1 s 0 ms
Delay : 1 s 0 ms
Delay : 1 s 0 ms
Delay : 00:00:01.000
Delay, origin : Container
Delay, origin : Container
Delay relative to video : 0
Delay relative to video : 00:00:00.000
Video0 delay : 0
Video0 delay : 00:00:00.000
Stream size : 2190720
Stream size : 2.09 MiB (5%)
Stream size : 2 MiB
Stream size : 2.1 MiB
Stream size : 2.09 MiB
Stream size : 2.089 MiB
Stream size : 2.09 MiB (5%)
Proportion of this stream : 0.05417
format_identifier : HDMV
In fact it's an _MediaInfo_ issue.
Version 0.94 and up are not able to parse many MTS and M2TS files without "freezing"
At least on Windows XP 32-bit.
Since 0.94 was introduced in the master...
@Sami32 It's still a bug in UMS' parsing, NumberformatException should always be handled when parsing strings to numbers.
He's working on this issue.
Do this code will do the job correctly ?
public static int getPixelValue(String value) {
if (!value.isEmpty()) {
try {
if (value.contains("pixel")) {
value = value.substring(0, value.indexOf("pixel"));
}
value = value.trim();
// Value can look like "512 / 512" at this point
if (value.contains("/")) {
value = value.substring(0, value.indexOf('/')).trim();
}
int pixels = Integer.parseInt(value);
return pixels;
} catch (NumberFormatException nfe) {
LOGGER.debug("Could not parse pixels \"" + value + "\"");
}
}
}
@Sami32 Almost. You only need to cover the line int pixels = Integer.parseInt(value); with the try, but you need to return something when the parsing fails. I don't know what's the best thing to return, I usually use 0 or -1. You will also have to return something if the value is empty, as long as the method is supposed to return an int it must always return an int unless it throws an exception. An exception that is caught "doesn't count" because it never leaves the method, which means that you have to return something from the catch clause as well.
@Sami32 To give you an example:
public static int getPixelValue(String value) {
if (isBlank(value)) {
return 0;
}
if (value.contains("pixel")) {
value = value.substring(0, value.indexOf("pixel"));
}
value = value.trim();
// Value can look like "512 / 512" at this point
if (value.contains("/")) {
value = value.substring(0, value.indexOf('/')).trim();
}
try {
return Integer.parseInt(value);
} catch (NumberFormatException e) {
LOGGER.debug("Could not parse pixels \"{}\": {}", value, e.getMessage());
LOGGER.trace("", e);
return 0;
}
}
@Nadahar Thank for the sample, yes, sorry but it far better for my little brain.
If i push a PR you'll approve it, or is that will still an other "dead" PR ?
I prefer ask before, as you'll probably ask for all the integer "catch" refactor, avoid me frustration, irritation and loosing time against my will...
That's said if you push it, i'll approve it, ME :tongue:
@Sami32 Of course I will approve it if it's working.
@Nadahar If "working" was your only criteria for approval, i should surely be the first one here to know about :tongue:
@Sami32 We have different ideas about "working". I don't only mean working for the intended situation, but for all the unforseen situations as well 馃槈
@Nadahar I know, on the foreground i share it, but on other hand that doesn't stop me to personnally feel "itching" about you, sometimes ;)