justdan96 / tsMuxer

tsMuxer is a transport stream muxer for remuxing/muxing elementary streams, EVO/VOB/MPG, MKV/MKA, MP4/MOV, TS, M2TS to TS to M2TS. Supported video codecs H.264/AVC, H.265/HEVC, VC-1, MPEG2. Supported audio codecs AAC, AC3 / E-AC3(DD+), DTS/ DTS-HD.
Apache License 2.0
853 stars 144 forks source link

Enhancement: Support converting BD folder to ISO ? #149

Open sgmihai opened 4 years ago

sgmihai commented 4 years ago

I found no way to do this, as the input must be a file. Is the resulting ISO even Bluray compliant ? ( UDF 2.50 ). If not, then I guess it would be a good feature request, because I found no way to make iso images from bluray folders and I have to use a windows vm with imgburn for this, which is not cool.

FilipeAmadeuO commented 4 years ago

Imgburn allows easily to create ISO compliant files from folder

lighterowl commented 4 years ago

While this is doable, it would probably require implementing UDF 2.50/2.60 from scratch, since support among source-available tools seems to be non-existent at best.

sgmihai commented 4 years ago

Ah ok, I was hoping that tsmuxer already has udf 2.50 support when writing to .iso. Too bad. I wonder how did imgburn implement this ? Written from scratch or does windows have libraries that can be called to achieve this ? If there's windows native support for writing udf 2.50, I don't think we can find an open source implementation for windows that can be ported to linux. And we just have to wait until someone does this, as time would be better spent improving tsmuxer rather than adding this feature. Maybe start a bounty program for it.

jcdr428 commented 4 years ago

@sgmihai Can't you use imgburn with wine on linux ?

sgmihai commented 4 years ago

@sgmihai Can't you use imgburn with wine on linux ?

Thanks for this message. It did not work for me so far and I did not bother to google it, but it seems that just setting the OS in wine to Windows XP fixes it. This is an acceptable temporary solution. Ideally it would be something that can be called from the command line though.

justdan96 commented 4 years ago

I've sent off an email to an open source project working on UDF 2.5 ISO creation, if I get a response I'll post it here.

justdan96 commented 4 years ago

No response from the author yet, NetBSD has full support for UDF 2.5 and 2.6 according to Wikipedia, the person that developed that functionality in NetBSD also developed a standalone program called UDF Client that works cross-platform. It appears that the code in NetBSD is newer than that of UDF Client but a lot of the code is similar. Crucially 2.5 and 2.6 write support are missing from UDF Client.

So either we convince the original UDF Client developer to move over the NetBSD code into the standalone program, we put the NetBSD code back into UDF Client ourselves or we take what we need from the NetBSD code and try to develop something that is cross-platform as a new project.

God-damnit-all commented 4 years ago

I've been looking for a reliable way to create UDF 2.5/2.6 ISOs for quite some time. The lack of support for UDF on linux in general has been frustrating. I did my best to try and get ImgBurn to work properly on Wine but it never seemed to want to take.

justdan96 commented 4 years ago

I've started some of the work on putting the NetBSD code back into UDF Client but there is still a lot missing. Maybe I'll just put up the code I have so far and hope someone else can help out with it!

justdan96 commented 4 years ago

Also apparently Nero Linux 4 can create UDF 2.5 ISOs but I haven't had much success with it! https://en.m.wikipedia.org/wiki/Nero_Linux

justdan96 commented 4 years ago

Response from the developer "option would be to use NetBSDs 'makefs -t udf' where I added support for creating (non bootable) UDF disc images as part of the UDF support. It will create fully populated UDF discs and it should be able to create UDF 2.50 BluRay disc images for BD-RE and BD-ROMs." I'd have to take a look at how to port NetBSD's makefs onto other platforms but I'm not sure I have the spare time.

For now I have wrote a guide on how to use nerocmd on Linux here: https://medium.com/@justdan96/using-nerocmd-in-ubuntu-19-10-627c5b157fed

lighterowl commented 4 years ago

As mentioned in #201, support for nerocmd could be integrated into tsMuxer without a lot of effort, but full UDF 2.50 support would require significantly more time. @justdan96 If you agree with this approach, I guess it would make most sense to split this issue into two and track progress separately.

sgmihai commented 4 years ago

@justdan96 Can you confirm you managed to write an actual BD video image with nerocmd ? I tried with both the nerolinux 3.5 from the Arch user repo, and the 4.0b pkgbuild found here:https://aur.archlinux.org/cgit/aur.git/tree/?h=nerolinux

With the gui I was only able to get it to write the image if running as root, and editing .nero/config to allow DVD overburn past 4600MB which is the default (cannot be changed from gui, it maxes out at 4600). I chose .iso format and it wrote it, but the resulting image was split every 16GB so it resulted in multiple parts. Mpv opened the .iso (First part) and only the first 16GB worth of movie was playable. Concatenating the 3 parts into one piece resulted in a functional image as far as I can tell.

With nerocmd I tried your command line from the article, but using the folder path instead of a single file. echo "ECT-PPT-UDF-BD.iso" | nerocmd --write --drive=-1,0 --bd --udf --udf-revision=2.50 --udf-partition-type=physical --data "/path/to/bluraydisc" Result is:

Last detected media: BD-R/RE, BD DL
Requested media: BD-R/RE, BD DL

There is not enough space to burn this compilation to this disc.

Please insert another disc that has enough space... [#] Compilation will not fit onto a blank disc

Obviously ther is enough disk space, and I have no idea how to feed it a whole folder. You only gave an example with a zip file.

Please tell us how/if you did, and if you found any way to avoid the 16GB splitting problem, of if you found any more elegant solutions in the meantime.

justdan96 commented 4 years ago

That command should be correct, I never had to burn anything bigger than 16GB so can't comment on that. The only open source solution for getting UDF 2.6 support (I think) would be to port NetBSDs 'makefs -t udf'.

sgmihai commented 4 years ago

@justdan96 Can you check your command syntax against a whole folder with files, subfolders, etc and see if it works for you ? I fail to see the use case of making an .iso with a single file in it.

jcdr428 commented 4 years ago

@justdan96 I know nothing about Linux, but doesn't newfs_udf support UDF 2.50 ?

The newfs_udf utility creates an UDF file system on device special suitable for the media currently inserted.
The options are as follow:
[ ]
-V max_udf  Select max_udf as the maximum UDF version to be supported.  For UDF version 2.50, use ``0x250'' or ``2.50''.

Edit: it is for the open-source NetBSD only, I suppose it could be ported to any other Linux easily ?

dfgweb commented 3 years ago

Just fyi, under Linux with Wine, I've used ImgBurn (http://www.imgburn.com/) to build UDF2.50 images and burn them.

justdan96 commented 3 years ago

I successfully created a BD folder in tsMuxer, then created the ISO in the command line with:

cd BD_Folder
echo "BD_Folder.iso" | nerocmd --write --drive=-1,0 --bd --udf --udf-revision=2.60 --udf-partition-type=physical --data *
jcdr428 commented 3 years ago

Hi @justdan96, but then if you use UDF 2.6 the Blu-ray player should only show the folders, not play the movie.

justdan96 commented 3 years ago

@jcdr428 sorry I didn't quite understand you there? To be fair it would still need further testing and I don't have a Blu-ray player to really test it with, or even a Blu-ray drive for me to try to back up my existing disks and compare the files against the nerocmd output.

pali commented 3 years ago

Hello! Just one important note: Neither udftools nor udfclient nor NetBSD makefs/newfs_udf/ support ISO. All these tools supports only UDF. So if you are targeting ISO as written in the first comment then none of these tools helps and I think that ISO support into these tools would be never integrated (as aim of these tools is not ISO, but UDF).

Anyway, if somebody here is interested in developing generation of UDF 2.50/2.60 (not ISO), I can help with it for udftools.

And ad nerocmd, it can really generates UDF 2.50 suitable for blu-ray, I used it in past but I do not remember exact arguments. But it has also support to just generate UDF image and store it to disk (instead of burning to media, called virtual drive). So later you can use any other tool for burning or you can inspect image...

Randrianasulu commented 2 years ago

@pali, @justdan96 @xavery - from https://github.com/justdan96/tsMuxer/blob/master/tsMuxer/iso_writer.cpp it seems some support for this metadata file/partition was coded into tsmuxer. Not with bitmap file (so no support for adding/removing any file at any time), but some basics of filewriting.. I am on termux /android arm 32 bit environment right now, so I can't test real big files.

my hacks on udfclient (only compile fixes for termux) and newfs_udf from netbsd (already posted them on mkudffs/udftools page) https://github.com/Randrianasulu/newfs_udf-linux https://github.com/Randrianasulu/udfclient-termux

Randrianasulu commented 2 years ago

see also comments under this articke (I think back in 2010 tsmuxer was unable to write directly to image file) :

https://irishjesus.wordpress.com/2010/10/17/blu-ray-movie-authoring-in-linux/

imgburn commans from comments (creating image file with .iso extension but udf inside)

bash$ wine ~/.wine/drive_c/Program\ Files/ImgBurn/ImgBurn.exe /MODE BUILD /OUTPUTMODE IMAGEFILE /SRC “C:\users\username\Desktop\path\to\tsMuxer\output\folder” /DEST “C:\users\username\Desktop\path\to\final.iso” /FILESYSTEM “UDF” /UDFREVISION “2.50” /VOLUMELABEL “some disk label” /NOIMAGEDETAILS /START /CLOSE

Randrianasulu commented 2 years ago

according to source https://github.com/NetBSD/src/blob/trunk/usr.sbin/makefs/udf.c

and man https://man.netbsd.org/makefs.8

max version of udf fs for makefs is just 2.01 (

Randrianasulu commented 2 years ago

i mashed together makefs_udf for linux (termux)

https://github.com/Randrianasulu/makefs_termux

Randrianasulu commented 2 years ago

here we can see udfinfo output from tsmuxer-created iso burned to dvd... so yeah it contain some fs claiming to be udf 2.50

justdan96 commented 2 years ago

@Randrianasulu that's really good work, I can see a lot of people using that!

jcdr428 commented 2 years ago

@sgmihai @Randrianasulu please test latest release, to see whether the fixes are enough for a standalone player to recognize the ISOs as proper UDF 2.50.

jcdr428 commented 2 years ago

@sgmihai tsMuxer now outputs compliant UDF2.5 ISOs (cf. issue #498). I close this issue: to convert a folder to ISO is the purpose of an app such as imgburn or Nero, rather than tsMuxer.

God-damnit-all commented 2 years ago

@sgmihai tsMuxer now outputs compliant UDF2.5 ISOs (cf. issue #498). I close this issue: to convert a folder to ISO is the purpose of an app such as imgburn or Nero, rather than tsMuxer.

Won't you please reconsider? Sometimes I have Bluray data in a folder that needs to be made into an ISO. While Randrianasulu did present a nice solution, it would be much more reassuring for a well-maintained program like tsMuxer to offer the functionality without having to rely on a netbsd fork that probably won't receive the long-term support that this project will.

I'd be willing to make a donation for the feature through this site's new GitHub Sponsors option, if you ever feel like setting that up. Kofi works too.

jcdr428 commented 2 years ago

@sgmihai tsMuxer is fully coded to read files. It would imply really substantial changes to read folders. As @Randrianasulu suggested, under Linux you can use k3b to create iso from folder. Best solution would remain to use imgburn with wine.

God-damnit-all commented 2 years ago

@sgmihai tsMuxer is fully coded to read files. It would imply really substantial changes to read folders. As @Randrianasulu suggested, under Linux you can use k3b to create iso from folder. Best solution would remain to use imgburn with wine.

I see. That's a shame.

k3b relies on creating a virtual block device/loopback device, and unfortunately, those are restricted on my remote server because of the security risks those present.

I know that's not your problem, but that's my reason for so badly wanting tsMuxer to have folder-to-ISO functionality.

Randrianasulu commented 2 years ago

in the meantime makefs_udf was improved by original author, I tried to re-import changes into my Linux hack and it sort of works ( I need to run it twice over same iso for getting all 3 AVDPs..) but might contain subtly bugs..

@ImportTaste can you (re) test? https://github.com/Randrianasulu/makefs_termux