Wild Media Server Wild Media Server
 
 
 
E-Mail Us
Home Product Info Download Buy Forum Feedback Extend Trial Contact Us Sitemap
 
It is currently Wed Oct 27, 2021 8:49 pm

All times are UTC




Post new topic  Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sat Mar 10, 2012 10:53 pm 

Joined: Sat Apr 16, 2011 12:19 am
Posts: 17
Eugene,

Nice work, I was waiting a 64-bit version for a long time.
I'm facing problems with CoreAVC profile after upgrade.
With 32-bit version, everything went fine; when I upgraded to 1.50, the message "Stack overflow" was appearing at message log every time I tried to play a movie using CoreAVC.
Well, made some tests with profile and I realized that "Stack overflow" appears at message log when CoreAVC fails to parse input parameters.
I have a Sony TV which has the old known "aspect ratio" bug, many time ago I needed to add the "+ ' -vf "aspect=4:3"' workaround on my CoreAVC profile, that doesn't work on WMS 1.50 anymore.
Any suggestions? Thanks in advance. My current "Movies - CoreAVC" profile follows:

Code:
const
  csInputParams = '-f rawvideo -vcodec rawvideo -pix_fmt yuv420p -s %dx%d -r %s -i "%s"%s -i "%s"';

function CheckResult(aResult: Integer; aRaiseException: Boolean = True): Boolean;
begin
  Result := aResult = S_OK;
  if not Result and aRaiseException then
    RaiseException(Format('Error (code: %x) - %s', [aResult, SysErrorMessage(aResult)]))
end;

var
  bMatroskaSource, bMpegTS: Boolean;
  sAudioFormat, sCodecTag, sInputParams,
  sAudioMediaMajorType, sAudioMediaSubType,
  sVideoMediaMajorType, sVideoMediaSubType,
  sReadVideoPipeName, sWriteVideoPipeName,
  sReadAudioPipeName, sWriteAudioPipeName,
  sTranscodingParams, sAudioPinName, sVideoPinName: string;
  iAudioStreamNo, iAudioChannels1, iAudioChannels2, iAudioSampleRate, iAudioFormatTag,
  iVideoWidth, iVideoHeight, iVideoCompression: Integer;
  vCurrentPosition: Variant;
begin
  bMpegTS := SameText(mpFileType, 'mpegts');
  bMatroskaSource := SameText(ExtractFileExt(mpFilePath), '.mkv');
  TranscodingResult := False;
  if mpIsoItem or mpDvdItem or mpBdItem then begin
    if not CheckResult(WmsDirectShowAddResourceSource('ResourceSource')) then 
      Exit;
    if bMatroskaSource then begin 
       if not CheckResult(WmsDirectShowLoadFilter('Filters\MatroskaSplitter.ax',   // MPC - Matroska Splitter
                          '{149D2E01-C32E-4939-80F6-C07B81015A7A}', 'Source')) then
         Exit                 
    end else if not bMpegTS or not CheckResult(WmsDirectShowAddFilter('Haali Media Splitter (AR)', 'Source'), False) then begin   
      if not CheckResult(WmsDirectShowLoadFilter('Filters\MpegSplitter.ax', // MPC - Mpeg Splitter (Gabest)
                          '{DC257063-045F-4BE2-BD5B-E12279C464F0}', 'Source')) then   
        Exit;
    end;     
    if not CheckResult(WmsDirectShowConnectPin('ResourceSource', 'Source', 'Output', 'Input')) then
      Exit;
  end else begin
    if bMatroskaSource then begin 
       if not CheckResult(WmsDirectShowLoadFilter('Filters\MatroskaSplitter.ax',   // MPC - Matroska Source
                          '{0A68C3B5-9164-4A54-AFAF-995B2FF0E0D4}', 'Source')) then
         Exit                 
    end else if not bMpegTS or not CheckResult(WmsDirectShowAddFilter('Haali Media Splitter', 'Source'), False) then begin
      if not CheckResult(WmsDirectShowLoadFilter('Filters\MpegSplitter.ax', // MPC - Mpeg Source (Gabest)
                            '{1365BE7A-C86A-473C-9A41-C0A6E82C9FA3}', 'Source')) then   
        Exit;
    end;
    if not CheckResult(WmsDirectShowSetFileName('Source', InputFileName)) then
      Exit
  end;
  iAudioStreamNo := mpAudioStreamNo;
  if iAudioStreamNo = -1 then
    iAudioStreamNo := 0;
  if bMatroskaSource then begin
    WmsDirectShowGetPinName('Source', PINDIR_OUTPUT, sVideoPinName, MEDIATYPE_Video, 0);
    WmsDirectShowGetPinName('Source', PINDIR_OUTPUT, sAudioPinName, MEDIATYPE_Audio, iAudioStreamNo);
  end else begin
    sVideoPinName := 'Video';
    sAudioPinName := 'Audio'; 
    WmsDirectShowSelectStream('Source', iAudioStreamNo, MEDIATYPE_Audio, WmsGetStreamID(stAudio, iAudioStreamNo));
  end; 
  if not CheckResult(WmsDirectShowGetMediaType('Source', PINDIR_OUTPUT, sAudioPinName,
        sAudioMediaMajorType, sAudioMediaSubType, iAudioChannels1, iAudioSampleRate, iAudioFormatTag)) then
    Exit;
  if sAudioMediaSubType = MEDIASUBTYPE_WAVE_DTS then
    sAudioFormat := 'dts'
  else if sAudioMediaSubType = MEDIASUBTYPE_WAVE_DOLBY_AC3 then
    sAudioFormat := 'ac3'
  else if sAudioMediaSubType = MEDIASUBTYPE_AAC then
    sAudioFormat := 'aac'
  else if sAudioMediaSubType = MEDIASUBTYPE_MP3 then
    sAudioFormat := 'mp3'
  else
    sAudioFormat := '';
  if mpTimeStart <> '' then begin
    vCurrentPosition := WmsTimeConvert(mpTimeStart) * 10000000;
    if not CheckResult(WmsDirectShowSetPosition('Source', TIME_FORMAT_MEDIA_TIME, vCurrentPosition)) then
      Exit;
  end;                                                     
//  if not CheckResult(WmsDirectShowAddFilter('CyberLink H.264/AVC Decoder (TechnoTrend)', 'Video Decoder')) then
  if not CheckResult(WmsDirectShowAddFilter('CoreAVC Video Decoder', 'Video Decoder'), False) and
     not CheckResult(WmsDirectShowAddFilter('Microsoft DTV-DVD Video Decoder', 'Video Decoder')) then
    Exit;
  if not CheckResult(WmsDirectShowConnectPin('Source', 'Video Decoder', sVideoPinName, '')) then
    Exit;
//  WmsDirectShowProperties('Video Decoder');   
  if sAudioFormat = 'aac' then begin 
    if not CheckResult(WmsDirectShowAddFilter('ffdshow Audio Decoder', 'Audio Decoder')) then
      Exit;   
    if not CheckResult(WmsDirectShowConnectPin('Source', 'Audio Decoder', sAudioPinName, '')) then
      Exit;   
//    WmsDirectShowProperties('Audio Decoder');
  end; 
  if WmsCreateDualPipe(sReadVideoPipeName, sWriteVideoPipeName) and
     WmsCreateDualPipe(sReadAudioPipeName, sWriteAudioPipeName) then begin 
    if not CheckResult(WmsDirectShowAddDump(sWriteVideoPipeName, 'DumpVideo')) then
      Exit;
    if not CheckResult(WmsDirectShowAddDump(sWriteAudioPipeName, 'DumpAudio')) then
      Exit;   
    if not CheckResult(WmsDirectShowConnectPin('Video Decoder', 'DumpVideo', '', '', MEDIATYPE_Video, MEDIASUBTYPE_I420)) then
      Exit;
    if sAudioFormat = 'aac' then begin 
      if not CheckResult(WmsDirectShowConnectPin('Audio Decoder', 'DumpAudio', 'Out', '',
                          MEDIATYPE_Audio, KSDATAFORMAT_SUBTYPE_PCM)) then
        Exit;
      if not CheckResult(WmsDirectShowGetMediaType('Audio Decoder', PINDIR_OUTPUT, 'Out',
            sAudioMediaMajorType, sAudioMediaSubType, iAudioChannels2,
            iAudioSampleRate, iAudioFormatTag)) then
        Exit;
      sAudioFormat := Format(' -f s16le -ar %d -ac %d', [iAudioSampleRate, iAudioChannels2])
    end else begin
      if not CheckResult(WmsDirectShowConnectPin('Source', 'DumpAudio', sAudioPinName, '')) then
        Exit;
      if sAudioFormat <> '' then
        sAudioFormat := ' -f ' + sAudioFormat;
    end;       
    if not CheckResult(WmsDirectShowGetMediaType('DumpVideo', PINDIR_INPUT, '',
          sVideoMediaMajorType, sVideoMediaSubType, iVideoWidth, iVideoHeight, iVideoCompression)) then
      Exit;                                     
    WmsDirectShowGetFrameRate('DumpVideo', PINDIR_INPUT, '', mpFrameRate);
    if CheckResult(WmsDirectShowPlay) then begin
      sInputParams := Format(csInputParams, [iVideoWidth, iVideoHeight,
                                             ReplaceStr(FormatFloat('0.###', mpFrameRate), ',', '.'),
                                             sReadVideoPipeName, sAudioFormat, sReadAudioPipeName]);
      if mpTimeStart <> '' then
        sInputParams := '-ts ' + mpTimeStart + ' -muxpreload ' + IntToStr(WmsTimeConvert(mpTimeStart)) + ' ' + sInputParams;
      sTranscodingParams := sInputParams + WmsTranscodingVideoParams(0, 0, 0, 0, True, False) + ' -vf "aspect=4:3"' +
                            ' "' + OutputFileName + '"';
//      ShowMessage(sTranscodingParams);                     
      TranscodingResult := WmsTranscodingExecute('WMSMPEG', sTranscodingParams)
    end
  end
end.


Top
   
PostPosted: Sun Mar 11, 2012 6:31 am 

Joined: Tue Nov 17, 2009 8:05 pm
Posts: 2918
tuliolazarini wrote:
Eugene,
Any suggestions? Thanks in advance. My current "Movies - CoreAVC" profile follows:

Help - Backup - Run
Settings - Transcoder - Profiles - "Movies - CoreAVC" - Restore
Try to use the original version (CoreAVC 3.01 - no problems).


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 2 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Copyright 2009-2020 Wild Media Server Powered by phpBB® Forum Software © phpBB Limited