Jump to content

Add support for FFMPEG Concat Format


Go to solution Solved by Luke,

Recommended Posts

Pythoplanium
Posted (edited)

Greetings,

 

I am currently in the progress of integrating a huge DVD collection into Emby. Since I need to keep the files in their original form, manually transcoding is not an option. From searching this Forum I understand that improving DVD support is probably not going to happen, unless FFMPEG integrates native DVD playback.

This is not yet available, but what is possible is to use the .concat format:

 

On some DVDs it is possible to simply concatenate all the VOB files into one huge file. This is possible because they do not have any headers, and are simply split because they shall be below 1GB on DVDs. Unfortunatelty DVDs often contain timestamp warps. As far as I can tell, they occur on every chapter boundary. Because of the lack of headers, and the way ffmpeg handels length-determination and seeking, this makes playback with Emby of these naively merged files almost impossible.

 

One ffmpeg Developer came up with a simple solution: We 'virtually' split the files at these chapter boundaries, and then use FFPEGs support for playing back concatenated files, where we concat at chapter boundaries. Because ffmpeg is then aware of the positions of the warps, playback is possible. A script with generates the needed .concat files can be found at https://github.com/FFmpeg/FFmpeg/blob/master/tools/dvd2concat

 

There are also other applications besides DVDs. I have seen some feature requests for playing back 'stacked' files. This also seems like it wont be implemented in Emby itself, but if .concat files are supported could easily be done with ffmpeg.

 

Implementation wise it should be similar to adding any other file format.

An example ffmpeg command is:

ffmpeg -safe 0 -f concat -protocol_whitelist "concat,ffconcat,file,subfile" -i test.concat -acodec copy -vcodec copy output.VOB

Note the -safe 0, which allows for relative paths in the .concat file, and the protocol_whitelist, which is needed to allow .concat files to virtually segment the input files. More documentation can be found at https://trac.ffmpeg.org/wiki/Concatenate

An example .concat file looks like:

ffconcat version 1.0

stream
exact_stream_id 0x1E0

stream
exact_stream_id 0x80

file 'subfile,,start,0,end,67084288,,:./VIDEO_TS/VTS_01_1.VOB'
duration 00:02:04.300

file 'subfile,,start,67084288,end,228624384,,:./VIDEO_TS/VTS_01_1.VOB'
duration 00:04:59.333

file 'subfile,,start,228624384,end,390227968,,:./VIDEO_TS/VTS_01_1.VOB'
duration 00:04:59.767

file 'subfile,,start,390227968,end,552028160,,:./VIDEO_TS/VTS_01_1.VOB'
duration 00:04:59.700

file 'subfile,,start,552028160,end,713668608,,:./VIDEO_TS/VTS_01_1.VOB'
duration 00:04:59.700

file 'subfile,,start,713668608,end,875362304,,:./VIDEO_TS/VTS_01_1.VOB'
duration 00:04:59.700

file 'subfile,,start,875362304,end,1037023232,,:./VIDEO_TS/VTS_01_1.VOB'
duration 00:04:59.700

file 'subfile,,start,1037023232,end,1198741504,,:concat:./VIDEO_TS/VTS_01_1.VOB|./VIDEO_TS/VTS_01_2.VOB'
duration 00:04:59.700

file 'subfile,,start,125032448,end,286693376,,:./VIDEO_TS/VTS_01_2.VOB'
duration 00:04:59.700
...........

Sidenote: Is the sourcecode on GitHub compete? I tried to find where the ffmpeg command lines are generated but came up empty. The top post at https://emby.media/community/index.php?/topic/25561-transcoding-question/ seems to hint that there is already support for the concat protocol? But I cannot reproduce it, nor find the place in the code which should generate it. If support for the concat protocol is indeed already there, I could build a hacky workaround for allowing DVD support that way.

 

Thanks for any help <3

Edited by Pythoplanium
Posted

Let's backup and investigate your original assumption:

 

 

Since I need to keep the files in their original form, manually transcoding is not an option.

 

Why do you feel that way?

Pythoplanium
Posted

It is an Archive. I need to be able to reproduce the original DVDs including the Menu in physical form. Allowing integration into Emby is not an absolute necessity, but would be very nice to have.

Currently I am using a custom FUSE filesystem which parses the .concat files and just exposes the virtual sections as indivdual files to Emby. On most DVDs this works acceptable, since they do not have too many sections. But since Emby does not autoplay the next "part" of a multipart movie, this solution is a bit cumbersome.

Posted

Sounds like you are trying to live in between two different standards.

DVD is OLD stuff these days.  Burn a spare copy for archiving if you must and then convert the file to an MP4 or MKV with H.264 or H.265 so it's in a format that is direct playable on all devices.  You can then rename the files properly.

 

The stance for using Emby is that you are supplying it ready to use files of current standard media formats used for streaming.  This doesn't include DVD and BlueRay structures as they aren't streaming files but storage files.  That makes a huge difference.

 

You of course could add more storage and keep your files in multiple formats but to get the most from Emby or any software similar to it will require you to convert your files properly.

  • Solution
Posted

That's what we are already doing for both dvd and bluray folders. Our experimental transcoding support is based on using concat with the vob/m2ts files.

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...