Page 1 of 1

[SOLVED] mencoder_codec_specific_script parsing error in UMS-5.0.0

Posted: Sun Feb 15, 2015 7:00 pm
by tachyon
Hey Guys,

Looks like there's a bug in the parser for mencoder_codec_specific_script config line in 5.0.0.

I have the following in my mencoder expert settings:

Code: Select all

filename.contains("Anime") :: -sws 9 -vf pp=ac/al:f,hqdn3d,unsharp=l3x3:1,noise=10uah:3uah,gradfun=1.01
filename.contains("TV") || filename.contains("Movies") :: -sws 10 -vf pp=ac/al:f,hqdn3d=2:2:4,unsharp=l3x3:0.5,noise=12uah:5uah,gradfun=1.01
UMS escapes the double quotes and newlines correctly in the UMS.conf:

Code: Select all

mencoder_codec_specific_script = filename.contains(\"Anime\") :: -sws 9 -vf pp=ac/al:f,hqdn3d,unsharp=l3x3:1,noise=10uah:3uah,gradfun=1.01\nfilename.contains(\"TV\") || filename.contains(\"Movies\") :: -sws 10 -vf pp=ac/al:f,hqdn3d=2:2:4,unsharp=l3x3:0.5,noise=12uah:5uah,gradfun=1.01
However, UMS then added extra backslashes and returned a parsing error:

Code: Select all

DEBUG 17:55:37.831 [New I/O worker #24] Reading mencoder_codec_specific_script: "filename.contains(\\"Anime\\") :: -sws 9 -vf pp=ac/al:f,hqdn3d,unsharp=l3x3:1,noise=10uah:3uah,gradfun=1.01\nfilename.contains(\\"TV\\") || filename.contains(\\"Movies\\") :: -sws 10 -vf pp=ac/al:f,hqdn3d=2:2:4,unsharp=l3x3:0.5,noise=12uah:5uah,gradfun=1.01" (default: "")
DEBUG 17:55:37.859 [New I/O worker #24] Error while executing: filename.contains(\"Anime\") : Sourced file: inline evaluation of: ``filename.contains(\"Anime\");'' Token Parsing Error: Lexical error at line 1, column 19.  Encountered: "\\" (92), after : ""
Removing the backslashes altogether did let UMS escape the double quotes;

Code: Select all

DEBUG 18:03:45.207 [New I/O worker #24] Reading mencoder_codec_specific_script: "filename.contains(\"Anime\") :: -sws 9 -vf pp=ac/al:f,hqdn3d,unsharp=l3x3:1,noise=10uah:3uah,gradfun=1.01\nfilename.contains(\"TV\") || filename.contains(\"Movies\") :: -sws 10 -vf pp=ac/al:f,hqdn3d=2:2:4,unsharp=l3x3:0.5,noise=12uah:5uah,gradfun=1.01" (default: "")
But this will make UMS reads the config incorrectly, as in completely ignoring the newline to mark the start of the second condition:

Code: Select all

DEBUG 18:03:45.239 [mencoder-2] Starting /usr/local/bin/mencoder -ss 0 /media/Archives3/Media/Videos/Anime/[philosophy-raws][Soukyuu no Fafner]/[philosophy-raws][Soukyuu no Fafner][01][BDRIP][Hi10P FLAC][1424X1068].mkv -msglevel statusline=2 -oac lavc -of mpeg -mpegopts format=mpeg2:muxrate=500000:vbuf_size=1194:abuf_size=64 -ovc lavc -channels 6 -lavdopts debug=0:threads=4 -lavcopts autoaspect=1:vcodec=mpeg2video:acodec=ac3:abitrate=448:threads=8:keyint=5:vqscale=1:vqmin=1:vrc_maxrate=499000:vrc_buf_size=7000 -font /usr/share/fonts/truetype/msttcorefonts/Arial.ttf -subfont-text-scale 3 -subfont-outline 1 -subfont-blur 1 -subpos 98 -fontconfig -aid 0 -noautosub -sid 0 -fps 24000/1001 -ofps 24000/1001 -lavdopts fast -sws 9 -vf pp=ac/al:f,hqdn3d,unsharp=l3x3:1,noise=10uah:3uah,gradfun=1.01\nfilename.contains("TV") || filename.contains("Movies") :: -sws 10 -vf pp=ac/al:f,hqdn3d=2:2:4,unsharp=l3x3:0.5,noise=12uah:5uah,gradfun=1.01 -mc 0 -noskip -af lavcresample=48000 -srate 48000 -o /tmp/universalmediaserver/mencoder1423983825237
Some relevant mencoder output of the transcode above:

Code: Select all

DEBUG 18:03:45.296 [Thread-29] Opening video filter: [gradfun=1.01\nfilename.contains("TV")]
DEBUG 18:03:45.296 [Thread-29] Opening video filter: [noise=10uah:3uah]
DEBUG 18:03:45.296 [Thread-29] Opening video filter: [unsharp=l3x3:1]
DEBUG 18:03:45.296 [Thread-29] Opening video filter: [hqdn3d]
DEBUG 18:03:45.296 [Thread-29] Opening video filter: [pp=ac/al:f]
I've used this particular mencoder_codec_specific_script line since 4.0.2 with no issues.

Probably need a quick patch? What do you guys think?

EDIT: Forgot to include my build info:

Code: Select all

INFO  18:01:43.632 [main] Build: 420e5aa50 (2015-01-25)
INFO  18:01:43.632 [main] Java: OpenJDK 64-Bit Server VM 1.7.0_75 64-bit by Oracle Corporation
INFO  18:01:43.632 [main] OS: Linux 64-bit 3.13.0-45-generic
INFO  18:01:43.632 [main] Encoding: UTF-8
INFO  18:01:43.643 [main] Memory: 3840 MB
INFO  18:01:43.643 [main] Language: en_uk

Re: mencoder_codec_specific_script parsing error in UMS-5.0.0

Posted: Wed Feb 25, 2015 7:06 pm
by tachyon
Bumping for visibility.

FAKE EDIT: In hindsight, I should've posted this in the Linux Support section. Maybe a kind mod can be so kind as to move this thread there?

Re: mencoder_codec_specific_script parsing error in UMS-5.0.0

Posted: Sat Oct 24, 2015 8:47 am
by tachyon
I finally got time to troubleshoot this a little further.

Basically, I have to remove all the escape backslashes and newlines("\n") using the custom script editor GUI. By letting the editor insert the newlines instead, the parser will work correctly. Not exactly sure why since the resulting UMS.conf looks almost the same as the one produced by UMS-4.4.0.

Anyway, I'm glad I can use the latest version now. I'll probably look into the source on GitHub later on to see how the custom script is actually saved.