Jump to content

Think I found the reason why .sub subtitles doesn't play when transcoding...


HomerS
 Share

Recommended Posts

Hi , playing movies with idx/sub over dlna has never worked for me, I been using the latest dev build and every time I try to play a movie with sub/idx my tv respond with a "format not supported" error. Playing the same movie with a srt subtitle works just fine.

 

 

The reason that sub/idx doesn't work is that the transcoding is failing when it cant find the .sub file when the path contains a whitespace as the cmdline reference  -i isn't inclosed in "-marks.  The last row in the transcoding log tells the tale.(see example below)

 

I guess this would be an easy thing to fix ?

 

 

C:\Users\KAKA123\AppData\Roaming\MediaBrowser-Server\ffmpeg\20141111\ffmpeg.exe -fflags +genpts -i file:"\\BOX\HDMOVIES\The Identical\The.Identical.2014.720p.BluRay.x264-ROVERS.mkv" -i \\BOX\HDMOVIES\The Identical\The.Identical.2014.720p.BluRay.x264-ROVERS.sub -map 0:0 -map 0:1 -map 1:0 -sn -codec:v:0 libx264 -force_key_frames expr:gte(t,n_forced*5) -preset superfast -crf 23 -maxrate 7363491 -bufsize 14726982 -vsync vfr -level 41 -filter_complex "[1:0]format=yuva444p,scale=1280:528,lut=u=128:v=128:y=gammaval(.3) ; [0:0] overlay,scale=trunc(min(iw\,1920)/2)*2:trunc(min((iw/dar)\,1080)/2)*2" -map_metadata -1 -threads 2 -codec:a:0 ac3 -ac 6 -ab 320000 -af "aresample=async=1" -y "C:\Users\KAKA123\AppData\Roaming\MediaBrowser-Server\transcoding-temp\streaming\270773ba3ea480678902893d63bbf6c0.ts"
 
 
ffmpeg version N-67521-g48efe9e Copyright © 2000-2014 the FFmpeg developers
  built on Nov 11 2014 01:15:40 with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      54. 11.100 / 54. 11.100
  libavcodec     56. 12.100 / 56. 12.100
  libavformat    56. 12.103 / 56. 12.103
  libavdevice    56.  2.100 / 56.  2.100
  libavfilter     5.  2.103 /  5.  2.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, matroska,webm, from 'file:\\BOX\HDMOVIES\The Identical\The.Identical.2014.720p.BluRay.x264-ROVERS.mkv':
  Metadata:
    encoder         : libebml v1.3.0 + libmatroska v1.4.0
    creation_time   : 2014-12-30 00:28:26
  Duration: 01:46:08.33, start: 0.000000, bitrate: 7363 kb/s
    Chapter #0:0: start 0.000000, end 774.107000
    Metadata:
      title           : 00:00:00.000
    Chapter #0:1: start 774.107000, end 1782.322000
    Metadata:
      title           : 00:12:54.107
    Chapter #0:2: start 1782.322000, end 2757.922000
    Metadata:
      title           : 00:29:42.322
    Chapter #0:3: start 2757.922000, end 3403.317000
    Metadata:
      title           : 00:45:57.922
    Chapter #0:4: start 3403.317000, end 4152.231000
    Metadata:
      title           : 00:56:43.317
    Chapter #0:5: start 4152.231000, end 4859.897000
    Metadata:
      title           : 01:09:12.231
    Chapter #0:6: start 4859.897000, end 5898.184000
    Metadata:
      title           : 01:20:59.897
    Chapter #0:7: start 5898.184000, end 6368.331000
    Metadata:
      title           : 01:38:18.184
    Stream #0:0(eng): Video: h264 (High), yuv420p, 1280x528 [sAR 1:1 DAR 80:33], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Stream #0:1(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s (default)
\\BOX\HDMOVIES\The: No such file or directory
 
 
 
  • Like 1
Link to comment
Share on other sites

Hi Luke and other devs  !

 

I had a look at the code myself to see if I could solve it. MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs 

 

By modifying the argument builder like below the problem would be solved , unless you see a better way to you think this could be implementet in the next dev build or so ?  ;)

 

       protected string GetInputArgument(EncodingJob job)
        {
            var arg = "-i " + GetInputPathArgument(job);


            if (job.SubtitleStream != null)
            {
                if (job.SubtitleStream.IsExternal && !job.SubtitleStream.IsTextSubtitleStream)
                {
                    arg += " -i \"" + job.SubtitleStream.Path + "\"";
                }
            }


            return arg;
        }
Link to comment
Share on other sites

this is what playback is using. we are actually already doing this. 

 

https://github.com/MediaBrowser/MediaBrowser/blob/master/MediaBrowser.Api/Playback/BaseStreamingService.cs#L829

 

the subs are burned in however the resolution is wrong. the subs need to be resized to match the output size of the video. if you look at the transcoding log you'll see debug messages about that. 

Link to comment
Share on other sites

Hi , maybe I was unclear but as I understand it , the problem is that ffmpeg can't find .sub file.

 

the cmdline should be like this with surrounding the path to the .sub file:

 

 ffmpeg.exe -fflags +genpts -i file:"\\BOX\HDMOVIES\The Identical\The.Identical.2014.720p.BluRay.x264-ROVERS.mkv" -i "\\BOX\HDMOVIES\The Identical\The.Identical.2014.720p.BluRay.x264-ROVERS.sub" -map 0:0 -map 0:1 -map 1:0 -sn -codec:v:0 libx264 -force_key_frames expr:gte(t,n_forced*5) -preset superfast -crf 23 -maxrate 7363491 -bufsize 14726982 -vsync vfr -level 41 -filter_complex "[1:0]format=yuva444p,scale=1280:528,lut=u=128:v=128:y=gammaval(.3) ; [0:0] overlay,scale=trunc(min(iw\,1920)/2)*2:trunc(min((iw/dar)\,1080)/2)*2" -map_metadata -1 -threads 2 -codec:a:0 ac3 -ac 6 -ab 320000 -af "aresample=async=1" -y "C:\Users\KAKA123\AppData\Roaming\MediaBrowser-Server\transcoding-temp\streaming\270773ba3ea480678902893d63bbf6c0.ts"

Link to comment
Share on other sites

I see now that the the " is indeed fixed in the latest builds ( running Version 3.0.5488.1547), now ffmpeg doesn't crash but it seams to be another problem with .sub transcoding. Subtitles doesn't show and the log is full of lines like this one.

 

frame= 8547 fps=200 q=23.0 size=  115531kB time=00:05:56.76 bitrate=2652.8kbits/s    

sub2video: rectangle overflowing
    Last message repeated 1 times
frame= 8651 fps=200 q=23.0 size=  116414kB time=00:06:01.11 bitrate=2640.9kbits/s    
sub2video: rectangle overflowing
    Last message repeated 1 times
frame= 8756 fps=200 q=23.0 size=  117597kB time=00:06:05.43 bitrate=2636.2kbits/s    
sub2video: rectangle overflowing
    Last message repeated 1 times
 
 
maybe thats the resize problem you talk about ?  
I googled and it seams to be a common problem.
 
Anyway , good work to all you devs!
Edited by HomerS
Link to comment
Share on other sites

  • 2 weeks later...

 

I see now that the the " is indeed fixed in the latest builds ( running Version 3.0.5488.1547), now ffmpeg doesn't crash but it seams to be another problem with .sub transcoding. Subtitles doesn't show and the log is full of lines like this one.

 

frame= 8547 fps=200 q=23.0 size=  115531kB time=00:05:56.76 bitrate=2652.8kbits/s    

sub2video: rectangle overflowing
    Last message repeated 1 times
frame= 8651 fps=200 q=23.0 size=  116414kB time=00:06:01.11 bitrate=2640.9kbits/s    
sub2video: rectangle overflowing
    Last message repeated 1 times
frame= 8756 fps=200 q=23.0 size=  117597kB time=00:06:05.43 bitrate=2636.2kbits/s    
sub2video: rectangle overflowing
    Last message repeated 1 times
 
 
maybe thats the resize problem you talk about ?  
I googled and it seams to be a common problem.
 
Anyway , good work to all you devs!

 

 

Yes .sub-based subtitles need to be resized to match the video. If someone can research the command for that, then we can incorporate the fix.

Link to comment
Share on other sites

no, i don't think so. we have to use a resize filter to make the subtitle size match the size of the output video. i just don't know what the command line for it is yet.

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...