Jump to content

Converting to Direct Play compatible formats


Recommended Posts

Jdiesel
Posted (edited)

I believe there is already a FR out for this however I was unable to find it. The idea is that you convert existing videos to a compatible format in advance so it is able to be direct played when the time comes. Ideally this is something that will become a core tool of Emby but in the meantime I thought we could share some ffmpeg strings and scripts to achieve a similar outcome.

 

I will start by sharing my ffmpeg script which copies the video, audio, and subtitle streams in an existing file and creates a second 2-channel aac audio stream. This then allows the video to be direct played on devices that are not setup for or support multichannel audio while maintaining all streams from the original file. In my case I wanted to direct play when using a Roku connected which is not hooked up to a AC3/DTS audio device to enable thumbnails when seeking. The string is setup to process all mkv's in a directory and append aac to the newly created version. This still leaves the source file intact but a script could be made to delete the source file after it has been processed.

for f in *.mkv; do ffmpeg -i "$f" -map 0:v -c:v copy -c:s copy -map 0:a -c:a:0 copy -map 0:a -c:a:1 aac -ac 2 "${f%.*}.aac.mkv"; done
 
Edited by Jdiesel
Posted

I believe there is already a FR out for this however I was unable to find it. The idea is that you convert existing videos to a compatible format in advance so it is able to be direct played when the time comes. Ideally this is something that will become a core tool of Emby but in the meantime I thought we could share some ffmpeg strings and scripts to achieve a similar outcome.

 

I will start by sharing my ffmpeg script which copies the video, audio, and subtitle streams in an existing file and creates a second 2-channel aac audio stream. This then allows the video to be direct played on devices that are not setup for or support multichannel audio while maintaining all streams from the original file. In my case I wanted to direct play when using a Roku connected which is not hooked up to a AC3/DTS audio device to enable thumbnails when seeking. The string is setup to process all mkv's in a directory and append aac to the newly created version. This still leaves the source file intact but a script could be made to delete the source file after it has been processed.

for f in *.mkv; do ffmpeg -i "$f" -map 0:v -c:v copy -c:s copy -map 0:a -c:a:0 copy -map 0:a -c:a:1 aac -ac 2 "${f%.*}.aac.mkv"; done
How does this differ from the built-in Sync functionality?
Jdiesel
Posted

The difference with this versus using the sync feature is that the sync feature requires an entire second file including both video and audio be stored. This command will create a file that is only slightly larger than the original (20-50 MB) because it is sharing the same video stream. While probably not that helpful for most, it can help those who have encodes that didn't include a second audio stream when first created.

 

I think the ultimate goal would be to have the ability to create these types of media conversions within Emby and run them as scheduled tasks.

zigzagtshirt
Posted

The difference with this versus using the sync feature is that the sync feature requires an entire second file including both video and audio be stored. This command will create a file that is only slightly larger than the original (20-50 MB) because it is sharing the same video stream. While probably not that helpful for most, it can help those who have encodes that didn't include a second audio stream when first created.

 

I think the ultimate goal would be to have the ability to create these types of media conversions within Emby and run them as scheduled tasks.

So what you're wanting is a feature that will preserve the original video and audio, and append an additional audio track that is universally direct playable?

Jdiesel
Posted

So what you're wanting is a feature that will preserve the original video and audio, and append an additional audio track that is universally direct playable?

Yes that is one example and something that I am doing manually right now. Another example might be to burn in forced subtitles. I'm curious to what others might be doing or wanting. 

Deathsquirrel
Posted

Yes that is one example and something that I am doing manually right now. Another example might be to burn in forced subtitles. I'm curious to what others might be doing or wanting. 

 

Burning in forced subs is definitely not something you want to automate.  Having done it in handbrake, there doesn't appear to be any consistent way these are stored and flagged on the source disc.

 

Really there isn't a setting for reencoded video that's universally usable while producing good results.  I don't see this being workable.

Waldonnis
Posted

Burning in forced subs is definitely not something you want to automate.  Having done it in handbrake, there doesn't appear to be any consistent way these are stored and flagged on the source disc.

 

Really there isn't a setting for reencoded video that's universally usable while producing good results.  I don't see this being workable.

 

You could script burn-in of internal or external SRT subs rather easily, but I agree with Deathsquirrel in principle.  I script a lot of operations, but some things just need a bit of hand-holding or you may not like what you end up with.  Even audio conversions/downmixing can result in some really terrible output for certain source layouts/content (example: do an AAC stereo downmix on any Star Wars movie's lossless audio track using ffmpeg's defaults...very not good).  At least audio transcoding is fast, though, so redoing it isn't a big deal if the results of a scripted transcode weren't good.  Redoing a video transcode because subtitle burn-in went badly is another matter entirely time-wise (and may have a quality impact as well).

 

If you're not crazy-picky like me, though, go nuts...just keep the source files handy until you review the results and know that they're satisfactory for you  :D  Few things suck more than being having to go back to disc/master and start your process all over because you didn't double-check your output....been there, done that...many times  :wacko:

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...