Internet Television -Movies - VLC - FFMPEG subtitle language

Post Reply
Adiall
Posts: 4
Joined: Mon Sep 12, 2011 10:42 am

Internet Television -Movies - VLC - FFMPEG subtitle language

Post by Adiall »

I'm using Movies - VLC - FFMPEG profile to watch mpegts channel with more than one subtitles:
channel1.png
channel1.png (22.87 KiB) Viewed 7013 times
but it doesn't apply.

I modified Movies - VLC - FFMPEG profile, adding "--sub-language eng" to VLC parameters

Code: Select all

csVlcParams = '-Idummy --language en --sub-language eng --demuxdump-file="%s" "%s" :demux=dump';
and command lines:

Code: Select all

"D:\VLC\vlc.exe" -Idummy --language en --sub-language eng --demuxdump-file="\\.\pipe\13EA55FD2EA54615BA88C41FB623F1C9" "http://url_here" :demux=dump
"C:\Program Files (x86)\Wild Media Server\wmsmpeg.exe" -f "mpegts" -probesize 7000000 -analyzeduration 10000000 -i "\\.\pipe\8C65312F93724755A47D6A9B5D791AC7" -f dvd -padleft 240 -padright 240 -padtop 0 -padbottom 0 -padcolor 000000 -s 1440x1080 -vhook "wmssubt.dll http://url_here,Arial Narrow,54,0,16777215,0,5,0,0,0,1920,1080,25.000,0,240,0,eng [0x46],0,1" -vcodec mpeg2video -b 3000000 -aspect 16:9 -copyts -pix_fmt yuv420p -r 23.976 -threads 4 -acodec ac3 -ab 448000 -ar 48000 -ac 2 -map 0:1 -map 0:0 "G:\Temp_MediaServer\WmsTemp\Test_43432ee06dc7e09a6a34fe20aa9816f8.mpg"

I made few tests:

- I executed manually:

Code: Select all

"D:\VLC\vlc.exe" -Idummy --language en --sub-language eng --demuxdump-file="G:\vlc_out.mpg" "http://url_here" :demux=dump
And

Code: Select all

"C:\Program Files (x86)\Wild Media Server\wmsmpeg.exe" -f "mpegts" -probesize 7000000 -analyzeduration 10000000 -i "G:\vlc_out.mpg" -f dvd -padleft 240 -padright 240 -padtop 0 -padbottom 0 -padcolor 000000 -s 1440x1080 -vhook "wmssubt.dll http://url_here,Arial Narrow,54,0,16777215,0,5,0,0,0,1920,1080,25.000,0,240,0,eng [0x46],0,1" -vcodec mpeg2video -b 3000000  -aspect 16:9 -copyts -pix_fmt yuv420p -r 23.976 -threads 4 -acodec ac3 -ab 448000 -ar 48000 -ac 2 -map 0:1 -map 0:0 "G:\wms_out.mpg"
The results:
vlc_out.mpg - without subtitle
wms_out.mpg - without subtitle
If I try like without demux it is working fine:

Code: Select all

"D:\VLC\vlc.exe" -Idummy --language en --sub-language eng "http://url_here"
Any ideas to solve this problem?
Eugene
Posts: 2940
Joined: Tue Nov 17, 2009 8:05 pm

Re: Internet Television -Movies - VLC - FFMPEG subtitle lang

Post by Eugene »

What about the transcoding profile "Internet-television" (change is needed for the subtitles) ?

P.S. I will think about this :)
Adiall
Posts: 4
Joined: Mon Sep 12, 2011 10:42 am

Re: Internet Television -Movies - VLC - FFMPEG subtitle lang

Post by Adiall »

Problem solved: soverlay does the magic :D

I changed Internet-television profile:

Code: Select all

csVideoLanParams =
    '--no-crashdump -Idummy --language=en%s --sout=#transcode' +
    '{vcodec=%s,vb=%d,fps=%s,scale=1%s,acodec=%s,ab=%d,channels=2,' +
    'samplerate=48000%s}:duplicate{dst=std{access=file,mux=%s,dst="<OUTPUT FILE>"}}' +
    ' "<INPUT FILE>"'; //  vlc:quit
with

Code: Select all

  csVideoLanParams =
    '--no-crashdump -Idummy --language=en%s --sout=#transcode' +
    '{vcodec=%s,vb=%d,fps=%s,scale=1%s,acodec=%s,ab=%d,channels=2,soverlay,' +
    'samplerate=48000%s}:duplicate{dst=std{access=file,mux=%s,dst="<OUTPUT FILE>"}}' +
    ' <INPUT FILE>'; //  vlc:quit
I added soverlay parameter and I removed "" from <INPUT FILE> because I want to specify subtitle language
Link format: --sub-language=eng "url here"

How can I "read" subtitle language selected by user? (see channel1.png above)
Eugene
Posts: 2940
Joined: Tue Nov 17, 2009 8:05 pm

Re: Internet Television -Movies - VLC - FFMPEG subtitle lang

Post by Eugene »

New version "Internet-television"

Code: Select all

function GetAudioCodec(const aFileFormat: string): string;
begin
  if Pos('ASF', aFileFormat) > 0 then
    Result := 'wma2'
  else if Pos('SONY', UpperCase(cfgDeviceType)) > 0 then  
    Result := 'mpga'
  else if Pos('IPOD', UpperCase(cfgDeviceType)) > 0 then  
    Result := 'aac'
  else                
    Result := 'mpga'    
end;

function GetFileFormat(const aFileFormat: string): string;
begin
  if Pos('ASF', aFileFormat) > 0 then
    Result := 'asf'
  else if (Pos('MPEGTS', aFileFormat) > 0) or
          (Pos('SONY', UpperCase(cfgDeviceType)) > 0) or
          (Pos('IPOD', UpperCase(cfgDeviceType)) > 0) then           
    Result := 'ts'    
  else  
    Result := 'mpeg1'
end;

function GetVideoCodec(const aFileFormat: string): string;
begin
  if Pos('ASF', aFileFormat) > 0 then
    Result := 'wmv2'
  else if Pos('IPOD', UpperCase(cfgDeviceType)) > 0 then  
    Result := 'h264'    
  else
    Result := 'mp2v'  
end;

const
  csVideoLanParams =
    '--no-crashdump -Idummy --language=en%s%s --sout=#transcode' +
    '{vcodec=%s,vb=%d,fps=%s,scale=1%s,acodec=%s,ab=%d,channels=2,' +
    'samplerate=48000%s%s}:duplicate{dst=std{access=file,mux=%s,dst="<OUTPUT FILE>"}}' +
    ' "<INPUT FILE>"'; //  vlc:quit
    
var 
  i, iWidth, iHeight, iAspectWidth, iAspectHeight, iAudioStreamID: Integer;
  sAudioTrackID, sCanvasParams, sFrameRate, sDeinterlace, sSubtitleParams, 
  sSubtitleStreamID, sSubtitleLanguage, sSubtitleOverlay: string;  
begin
  if WmsGetVideoSettings(vstDeinterlace) = 'on' then 
    sDeinterlace := ',deinterlace'
  else
    sDeinterlace := '';
  if mpInternetItem then
    sFrameRate := '24'
  else if cfgTranscodingFrameRate <> '' then                                      
    sFrameRate := cfgTranscodingFrameRate
  else if mpFrameRate > 0 then
    sFrameRate := FormatFloat('0.000', mpFrameRate)
  else
    sFrameRate := '25';
  if SameFloat(sFrameRate, '23.976') then
    sFrameRate := '24'
  else if SameFloat(sFrameRate, '29.970') then
    sFrameRate := '30'
  else if SameFloat(sFrameRate, '59.940') then
    sFrameRate := '60';    
  iWidth := mpWidth;     
  if iWidth > 0 then begin                         
    i := Pos(':', cfgTranscodingScreenFormat);
    if i > 0 then begin
      iAspectWidth  := StrToIntDef(Copy(cfgTranscodingScreenFormat, 1, i - 1), 16);
      iAspectHeight := StrToIntDef(Copy(cfgTranscodingScreenFormat, i + 1, 10), 9);      
    end else begin         
      iAspectWidth  := 16;
      iAspectHeight := 9      
    end;
    if iWidth > cfgTranscodingScreenWidth then
      iWidth := cfgTranscodingScreenWidth;
    if iWidth > 1280 then    
      iWidth := 1280;
    iHeight := Round((iWidth / iAspectWidth) * iAspectHeight);
    if iHeight mod 2 <> 0 then
      Inc(iHeight); 
    sCanvasParams := Format(',vfilter={canvas{width=%d,height=%d,aspect=%s}}', [iWidth, iHeight, cfgTranscodingScreenFormat]);
  end else
    sCanvasParams := '';          
  if mpAudioStreamNo >= 0 then begin  
    iAudioStreamID := WmsGetStreamID(stAudio, mpAudioStreamNo);    
    if iAudioStreamID < 100 then                          
      sAudioTrackID := ' --audio-track=' + IntToStr(mpAudioStreamNo)      
    else
      sAudioTrackID := ' --audio-track-id=' + IntToStr(iAudioStreamID)
  end else                 
    sAudioTrackID := '';
  sSubtitleParams  := '';              
  sSubtitleOverlay := '';                           
  if mpSubtitleLanguage <> '' then begin  
    if WmsRegExMatch('(.*?) ', mpSubtitleLanguage, sSubtitleLanguage) and (Trim(sSubtitleLanguage) <> '') then
      sSubtitleParams := ' --sub-language=' + sSubtitleLanguage
    else if WmsRegExMatch('\[0x(.*?)\]', mpSubtitleLanguage, sSubtitleStreamID) then    
      sSubtitleParams := ' --sub-track-id=' + IntToStr(StrToIntDef('$' + sSubtitleStreamID, 0));      
    if sSubtitleParams <> '' then
      sSubtitleOverlay := ',soverlay'  
  end;          
  TranscodingParams := Format(csVideoLanParams, 
                               [sAudioTrackID, sSubtitleParams, GetVideoCodec(cfgTranscodingFileFormat),
                                Min(cfgTranscodingVideoBitrate div 1000, 12000), sFrameRate,
                                sCanvasParams, 
                                GetAudioCodec(cfgTranscodingFileFormat),
                                Min(cfgTranscodingAudioBitrate div 1000, 192),
                                sDeinterlace, sSubtitleOverlay, GetFileFormat(cfgTranscodingFileFormat)]);                                
end.
Post Reply