View Full Version : AviSynth rendered subtitles to BluRay SUP/PGS and BDN XML (v2.08)
Taizenshū
8th August 2015, 16:51
"MakeSubs"? I only know "MaskSub".
Try VirtualDub. It should show the AviSynth error message. Make sure you only use 32 bit VirtualDub or MediaPlayer to open 32 bit AviSynth. Same goes for plugins: 32 bit AviSynth can only load 32 bit vsfilter.
Sorry that was a typo. So installed the 32bit version of VSFilter and now it's giving me this:
http://i.imgur.com/PaUy1jum.png (http://i.imgur.com/PaUy1ju.png)
I tried loading the avs file in VirtualDub but it's giving me this error:
http://i.imgur.com/Pmthv5K.png
sneaker_ger
8th August 2015, 17:10
That's strange, almost like AviSynth isn't installed. What does AviSynth Info Tool (http://forum.doom9.org/showthread.php?t=170647) show? Do you have the the latest stable version (http://sourceforge.net/projects/avisynth2/files/latest/download)?
Taizenshū
8th August 2015, 17:18
That's strange, almost like AviSynth isn't installed. What does AviSynth Info Tool (http://forum.doom9.org/showthread.php?t=170647) show? Do you have the the latest stable version (http://sourceforge.net/projects/avisynth2/files/latest/download)?
It shows me this:
http://i.imgur.com/ma2soea.png
sneaker_ger
8th August 2015, 17:29
Then I don't know why VirtualDub does not display the AviSynth error message. What error message here:
avs2pipemod.exe (http://www.mediafire.com/download.php?alg424t3kx7ak5d) -info 00001.avs
?
Taizenshū
10th August 2015, 15:46
Then I don't know why VirtualDub does not display the AviSynth error message. What error message here:
avs2pipemod.exe (http://www.mediafire.com/download.php?alg424t3kx7ak5d) -info 00001.avs
?
I'm away from home for now. I'll check when I get back next week.
Taizenshū
16th August 2015, 05:32
Sorry for the double post but I just wanted to as what should I do with with the software you sent?
Music Fan
12th September 2015, 13:33
Hi,
how to get transparency around a video converted in sup with avs2bdnxml ?
I'd like to display a black & white video (for example in 640*480) over a 1080p video (and use the little video as an interactive subtitle file). Thus the borders should be transparent, but if I add borders with avisynth (to get a 1080p file without resizing the 480p video), these borders are black. How to turn it transparent ?
Does the avisynth script have to send 1080p or it can be 640*480 and avs2bdnxml center this video with transparency all around in a 1080p window if resolution is set on 1080p in the avs2bdnxml script ?
Because I guess that the final sup has to get the same resolution than the video with which it will be muxed.
I can ask it differently : let's imagine I have a little animated logo I'd like to use as a subtitle file : how to choose its size and place in the video (using avisynth as input) if I want it to be displayed over a corner of the 1080p video ?
Thanks.
sneaker_ger
12th September 2015, 13:58
AviSynth needs to output in RGBA format (RGB with alpha channel) for avs2bdnxml to get the transparency info. The resolution should be the same as for your video (e.g. 1920x1080).
Music Fan
12th September 2015, 14:42
You mean the resolution of the avisynth script ?
If yes, how to add transparency with avisynth around the video (or logo, subtile or whatever) ?
ps auxw
12th September 2015, 14:48
You mean the resolution of the avisynth script ?
If yes, how to add transparency with avisynth around the video (or logo, subtile or whatever) ?
You can use a small video with the "--x-offset" and "--y-offset" options of avs2bdnxml to center it. This would be faster than having avs2bdnxml process a full size video too. You still have to ensure that the video is RGBA, i.e. add ConvertToRGB32.
Another way of achieving what you want would be using BlankClip to create a transparent video and then using Overlay to add your smaller video.
Please be aware that stuffing a video with many frames into the subtitle stream may lead to compatibility issues due to buffer limitations. If you only have a few frames it should be fine.
Music Fan
12th September 2015, 15:31
Thanks !
I tried with a black & white video resized in 176*100 and didn't specify any x or y position : the subtitle (muxed in TS with TSMuxer) is correctly displayed (in the top left corner) by VLC but not by MPC-HC.
The sup is fluid, as the video (23.976 fps).
I also tried with a 1080p video, it's accepted by avs2bdnxml and the (huge) sup is accepted by TSMuxer but VLC plays it with difficulty.
Is there a maximal recommanded bitrate for sup files (for dvd and Blu-ray) and how to see or calculate their bitrate ?
Is there a kind of compression in sup files or all frames have the same size (in the case of a sup created from a video, which means same resolution for all frames but with different content in all frames because of the movement) ?
sneaker_ger
12th September 2015, 15:55
I also tried with a 1080p video, it's accepted by avs2bdnxml and the (huge) sup is accepted by TSMuxer but VLC plays it with difficulty.
Did you use -a/--autocrop? There should not really be a difference in the final output between providing full 1080p resolution script vs a small script with offset as long as both have the same input. If you try to encode a "real" 1080p video you will exceed all the limits in terms of playback compatibility.
Is there a maximal recommanded bitrate for sup files (for dvd and Blu-ray) and how to see or calculate their bitrate ?
IIRC there should be warning if BluRay limits are exceeded.
Is there a kind of compression in sup files or all frames have the same size (in the case of a sup created from a video, which means same resolution for all frames but with different content in all frames because of the movement) ?
IIRC: simple run length compression (RLE).
Don't even think about doing anything crazy. The format is for common subtitles, not screen-filling animations/videos.
Music Fan
12th September 2015, 16:30
Did you use -a/--autocrop?
I guess yes, I used the script in 1st post containing -a1
IIRC there should be warning if BluRay limits are exceeded.
There was no warning while the 1080 sup is probably far beyond the BluRay limits.
I made another test with offset (50 for x and y) but the sup (from 176*100 video) is still in the top left corner with VLC, as if there were no offset, I don't know if it's a VLC or avs2bdnxml bug.:confused:
I tried to play the ts (put in AVCHD folder with TSMuxer) with 2 standalone Blu-ray players but none managed to play the sup from 176*100 video :o
When I turn on subtitles, the video begins to stutter a lot and sub are never displayed.
I believed it would be ok at this low resolution, especially because it was played from a USB key (which generally allows high bitrates).
I have to tell that both my players usually play subtitles in AVCHD folder created with TSMuxer, thus the problem is probably the bitrate but not the presence of subtitles.
Don't even think about doing anything crazy. The format is for common subtitles, not screen-filling animations/videos.
Actually I saw 2 commercial dvd's with complex subtitles ;
-one of classical music that can display musical scores (partitions) over the video
-the other is Men in Black with an optional "video commentary" : 2 guys were filmed during their commentary and the video was converted into a kind of black & white shadow encoded in sup, thus it's not as detailed as a video but we see the form of their body moving all along the commentary.
sneaker_ger
12th September 2015, 16:38
There was no warning while the 1080 sup is probably far beyond the BluRay limits.
Maybe I'm not remembering correctly. I'll let ps auxw answer...
ps auxw
12th September 2015, 18:36
Maybe I'm not remembering correctly. I'll let ps auxw answer...
I'm a little fuzzy on that too and I don't have the time to check right now, but you might have to use "-z1" to enable these.
If you are going to put video into the SUP, make sure it is low resolution and as low color/low detail as possible to save buffer space. To get a very rough approximation of the bitrate, you could store the frames as PNG with a the lowest compression level that still compresses. However, bitrate isn't really the problem. The issue is more how much space the decoded pictures take up.
I made another test with offset (50 for x and y) but the sup (from 176*100 video) is still in the top left corner with VLC, as if there were no offset, I don't know if it's a VLC or avs2bdnxml bug.:confused:
It used to work, but possibly hasn't be tested much recently, so there might be a regression. I'll try to take a look at it when I have time.
Edit: It's an avs2bdnxml bug. The offsets are currently only applied for XML output, not SUP output. This should be easy to fix. Thanks for reporting it.
ps auxw
12th September 2015, 19:07
Please test whether the offset issue is fixed with this: [removed]
Edit: Updated the archive to prevent a regression with offset handling and BDN-XML output.
Music Fan
13th September 2015, 08:30
Thanks for the update but there is a problem with the sup export, nothing appears now in VLC. And when I open the sup in Subtitle Edit, I get this message : "... does not contain any subtitles or contains errors", while the sup created yesterday is recognized (even its resolution is displayed ; 176 * 100, as the avisynth output).
And the sup size is three times smaller than the sup created yesterday with the same options.
By the way, I tried again MPC-HC (with Windows 7, yesterday I ran XP, I have both OS in dual boot) and it plays the TS created yesterday, but the sup is resized and covers the whole video, while the same TS is ok with VLC which shows the sup in the top left corner.
If you are going to put video into the SUP, make sure it is low resolution and as low color/low detail as possible to save buffer space. To get a very rough approximation of the bitrate, you could store the frames as PNG with a the lowest compression level that still compresses.
How can I choose the compression if I export in sup ?
The video is in black and white and if I lower the resolution, this will become very little (176*100 is not that big over a 1080p video), do you believe a blur in the avisynth script may help to lose detail -and thus increase sup compression- without lowering resolution ?
edit : I made another test : I opened the sup created yesterday with v2.08 in Subtitle Edit and exported it in Blu-ray SUP (thus nothing change except the x and y positions) : the resulting sup muxed in TS is now correctly playable in MPC-HC (except a mysterious out of sync problem) but not anymore in VLC, the opposite of the orignal sup !
edit 2 : AVCHD on USB key done with the sup that went through Subtitle Edit is played a little bit better (still stutters but less) than the AVCHD containing the original sup (done with v2.08), which probably means that Subtitle Edit makes a kind of correction (but the sup size is nearly the same than the original sup, a little bit bigger ; 17657 KB and 17504 KB for a 1 minute sup in 176*100 exported in 1080p).
ps auxw
13th September 2015, 13:23
Thanks for the update but there is a problem with the sup export, nothing appears now in VLC. And when I open the sup in Subtitle Edit, I get this message : "... does not contain any subtitles or contains errors", while the sup created yesterday is recognized (even its resolution is displayed ; 176 * 100, as the avisynth output).
And the sup size is three times smaller than the sup created yesterday with the same options.
That's very strange. Looks like I'll have to spend a bit of time on debugging.
How can I choose the compression if I export in sup ?
The video is in black and white and if I lower the resolution, this will become very little (176*100 is not that big over a 1080p video), do you believe a blur in the avisynth script may help to lose detail -and thus increase sup compression- without lowering resolution ?
Blur likely won't help, just reducing colors without dithering. You can't really choose the compression. It's just RLE as mentioned by sneaker_ger.
Music Fan
13th September 2015, 15:57
Blur likely won't help
You said earlier that low detail would help.
just reducing colors without dithering.
It's black and white.
ps auxw
13th September 2015, 16:49
You said earlier that low detail would help.
It's black and white.
Since the compression is RLE, it only compresses when there are multiple pixels with exactly the same color following one after the other. If it's already black and white, it's probably not going to get much better in that regard.
Music Fan
14th September 2015, 08:26
Ok, but I got 2 ideas ;
-lower even more resolution to lose detail then upscale it to get a reasonable size
-divide the framerate by 2 to lose fluidity then double framerate (with ChangeFPS() to simply duplicate frames), that may help for the RLE compression.
I can also add opacity but I don't know if it may help to decrease sup size.
edit : with this method, the sup is 2 times smaller. But I'm afraid it doesn't change anything for the player because as you said, only the decompressed sup's bitrate does matter. It's less detailed and less fluid but has probably the same bitrate after RLE decompression because at the end of the avs script, the framerate and resolution are the same.
edit 2 : strange thing ; for Subtitle Edit, there are 2 times less frames than what avs2bdnxml created, as if all the duplicated frames were discarded ! But each frame lasts 2 times longer, which means the timecodes of 2 successive and identical frames are merged for Subtitle Edit (and sup's speed is ok in VLC).
ketsuban
23rd November 2015, 15:28
Before anything else, big thanks ps auxw for having created the most useful and complete tool to render Blu-ray compliant subtitles, exploiting very well all the capabilities of the spec. I must thank as well all the users who have posted here along the years, since they contributed positively to improve it and provided very useful complementary information.
Being that said, I would like to ask if there could be a chance of including a new feature in this program, which I think it would make it even more outstanding. My proposal concerns the possibility of adding a feature consisting on converting existing XML+PNG subtitles to SUP and vice versa. If that was possible, I would be able to save a lot of time, especially if I could convert SUP subtitles to XML+PNG. I will next justify the motivation of proposing the inclusion of this feature.
Sometimes, I receive some SUP files provided by a third party extracted through tsMuxeR, in order to perform some operations with them (such as corrections, FPS modification, etc.). In order proceed with them, I need to convert it to XML+PNG, both for editing and for lately adding them to a Scenarist BD project in order to reauthor the content with the modified subtitles.
The problem with having only the SUP subtitles is that there is no tool capable of converting them back to XML+PNG correctly if there are some subtitles with dual windows partition of events (a well-known issue with programs such as BDSup2Sub); therefore, if I want to obtain the full subtitles without losing those who are in the second window, when that happens and if actually happens, I need to artificially convert correctly them through BD Reauthor Pro depending in the case:
a) If I have been provided a MKV with the SUP file muxed in them (for instance, coming from a BD Remux), I must artificially convert it to m2ts and demux it through BD Reauthor Pro in order to obtain a correct XML+PNG file.
b) If I only have a SUP file, I must mux it together with a dummy video with a greater or equal length than the OutTC of the last event, consuming a lot of time and unnecessary writting in the HDD as in the previous case.
Therefore, since this program handles well both XML+PNG and SUP formats, I though it would be interesting to add a supplementary tool to convert between the two formats, which, albeit being out of the main purpose of this tool, which is rendering subtitles, I'm sure it would become a very useful feature for some users like me when they face a situation as the one I mentioned above.
sneaker_ger
23rd November 2015, 17:58
The problem with having only the SUP subtitles is that there is no tool capable of converting them back to XML+PNG correctly if there are some subtitles with dual windows partition of events (a well-known issue with programs such as BDSup2Sub)
Have you tried BDSup2Sub++ 1.0.2?
ketsuban
23rd November 2015, 18:38
Have you tried BDSup2Sub++ 1.0.2?
Yes, and I still get the errors/warnings "Multiple PDS/ODS definitions: Result may be erratic" and "Duration of frame X is shorter than 533.867 ms" associated to the problem with multiple windows and short effects (events with concatenated subpictures), which should not appear.
ps auxw
26th December 2015, 02:36
Therefore, since this program handles well both XML+PNG and SUP formats, I though it would be interesting to add a supplementary tool to convert between the two formats, which, albeit being out of the main purpose of this tool, which is rendering subtitles, I'm sure it would become a very useful feature for some users like me when they face a situation as the one I mentioned above.
I like the idea and will probably work on it, once I find the time, but that might still be a while off.
XStylus
25th May 2016, 22:01
I like the idea and will probably work on it, once I find the time, but that might still be a while off.
I realize I'm necroposting, but I'd just like to add a +1 to that request.
What'd also be handy is a way to convert the BDN XML to a standard XML readable in an NLE such as Final Cut or Premiere. That way we can load this into an NLE and preview the subpics in there.
I currently know of no other way to easily preview these subpics against video.
ps auxw
25th May 2016, 23:44
I realize I'm necroposting, but I'd just like to add a +1 to that request.
That's just the way this thread tends to go. ;)
What'd also be handy is a way to convert the BDN XML to a standard XML readable in an NLE such as Final Cut or Premiere. That way we can load this into an NLE and preview the subpics in there.
I currently know of no other way to easily preview these subpics against video.
Interesting. Do you have a pointer for format docs of such "standard XML"?
XStylus
26th May 2016, 01:24
Interesting. Do you have a pointer for format docs of such "standard XML"?
Perhaps "standard" was the wrong word. More like typical. It's FCP7's standard, but it has been adopted by other NLEs such as Avid and Premiere. I can gladly provide example files though.
Will also be glad to throw money if it gets that particular feature done faster. ;)
ps auxw
28th May 2016, 12:48
Perhaps "standard" was the wrong word. More like typical. It's FCP7's standard, but it has been adopted by other NLEs such as Avid and Premiere. I can gladly provide example files though.
Will also be glad to throw money if it gets that particular feature done faster. ;)
If you PM me some samples, I'll take a look at it.
mp3dom
14th July 2016, 11:00
Is it possible to implement a dithering algo for the 8bit palette rendering? (or an enable/disable option) This can be really helpful when rendering subtitles with smooth gradients that actually are rendered with lots of color banding
ketsuban
12th August 2016, 13:45
I have found by mere chance a possible minor bug involving the time accuracy of some frames. My suspicions are mainly focused on the fact that it is possible that somewhere an inexact rounded fps value is used instead of the exact quotient in the case of non-integer fps such as 23.976 (24000/1001) or 29.97 (30000/1001). The particular example where I have found this issue is the following one, with a 29.97 (30000/1001) fps interlaced video:
The first video frame where it is intended to display that particular line, assuming, by the spec convention, that the frames start to be indexed by 0, is the frame number 37477. The time set in Aegisub for that purpose in format H:MM:SS:CS is 0:20:50:45, namely, at t=20*60+50.45=1250.45 s. Therefore, multiplying by 1001/30000 we have 37476.023976024, and therefore, according to the Aegisub criteria, rounding up the value the subtitle will appear in the frame starting from ceil(37476.023976024)=37477. Indeed, this is the desired result in Aegisub and the subtitle is displayed correctly there. However, after rendering this subtitle in avs2bdnxml, the subtitle appears however starting by the frame 37476, one frame before expected. This result is obtained if we use instead for the computations the inexact value 29.97, since 1250.45*29.97=37475.9865, and therefore ceil(37475.9865)=37476, which is coherent with my initial assumption about the possibility of using somewhere the inexact value. If the time value is changed by increasing an unit the CS to 0:20:50:46 then the issue is corrected in the BDN+XML output, because the result is still correct in Aegisub since in this case we have 1250.46*30000/1000=37476.3236763237 (approx.), hence ceil(37476.3236763237)=37477, and on the other hand 1250.46*29.97=37476.2862, and thus ceil(37476.2862)=37477 as well.
I have checked a bit the source code and it looks like you are doing the things well, so the problem might be in the output values provided by the AviSynth engine, although I am not completely sure. In any case, albeit I have only reported here this issue involving InTC values, I guess it happens as well in the OutTC case. If you could check this issue, confirm and fix it (if possible), I would be very grateful.
By the way, many thanks for considering my last request.
Minister
22nd August 2016, 19:28
I had formerly posted about an issue I had running this app, but it turned out to be a syntax error on my part. Sorry for making this unnecessary post.
KSSW
21st February 2024, 09:30
I wonder if the quality of PNG output is very high?
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.