Fixes to s/w encoder (2 Viewers)

Azazyel

Portal Member
February 17, 2007
18
0
Home Country
Havent had the time to do anything, just pointing out what needs to be done.

Anyway, the current software encoding as added on the 17th Jan 07 lacks a few things

1) Audio input from soundcard.
2) ATI MPEG encoder/muxer
3) The option to pick...options

Sorry its a bit short, but I am just checking if anyone is already working on these things, as it's too early in the morning for me to download the source and start building it with changes.

I've just tried to get it working with my DVICO DVB-T Plus, but it fails on the "No audio pin" before it gets any furthur, so I don't know much more.

1 should be a simple matter of another test on TvLibrary.Implementations.Analog.TvCardAnalogBase.FindAudioVideoPins() after adding the Audio Capture Source, and 2 is just modifying audioEncoders in AddAudioCompressor and the same for videoEncoders

Thoughts?
 

Taipan

Retired Team Member
  • Premium Supporter
  • February 23, 2005
    2,075
    44
    Melbourne
    Home Country
    Australia Australia
    I've just tried to get it working with my DVICO DVB-T Plus, but it fails on the "No audio pin" before it gets any furthur, so I don't know much more.
    Thoughts?

    Please feel to correct me if I am wrong, but the DVICO DVB-T Plus is a DVB only TV card and there is no encoding involved - the received stream is already in MPEG2 format?

    Or, are you referring to the separate analog video capture input (composite or SVHS) on that card?
     

    Frodo

    Retired Team Member
  • Premium Supporter
  • April 22, 2004
    1,518
    121
    53
    The Netherlands
    Home Country
    Netherlands Netherlands
    Current tvserver does support analog s/w encoding cards.
    But i agree that not all analog s/w cards work.
    More development should go into this to get it working for all analog s/w cards
    If you are interested in helping out, feel free todo so
    As far as i know, nobody else is working on it
     

    Azazyel

    Portal Member
    February 17, 2007
    18
    0
    Home Country
    Yeah, I meant the analog (Composite, I don't have an svideo inputs) input. Tv Server finds the video input, but fails because there is no audio output on the card, so the sound card capture needs to be added to the graph.

    Christ, 350MB for the .Net SDK 2.0!!!

    Edit: 430MB for DirectX SDK!?!?

    What happened to when you downloaded 300k and then annoying installer let you pick what you wanted to download?
     

    Azazyel

    Portal Member
    February 17, 2007
    18
    0
    Home Country
    I hacked it into working.

    By default, the code wanted to add the MPEG encoders, muxer, then connect a demuxer, then to that, connect another muxer, then save that to a file, then open the file and demux it :(

    So I hacked it for me to just use the first mux output for the file. And it works, but the player doesn't like the audio (The graph it creates has my ffdshow decoder, but it doesn't think it has any input) I think the demux doesn't like my muxer, but it used to work with gbpvr, so I'll fiddle some more tomorrow.

    I can play the outputed files with audio (using the same ffdshow), and the digital works with everything.

    So my plan is to find another DShow MPEG encoder/mux (Suggestions?), and give that a go. (The ATI one has a backwards A/V input anyway, audio is pin 0)

    Then I what do I do...? Make a patch, list the required changes?

    Anyway, thats for tomorrow. Ciao.
     

    fherrador

    Portal Member
    January 30, 2007
    28
    1
    63
    Home Country
    Spain Spain
    This can help maybe...

    I have the analog side working and had simmilar problems Azazyel, there is a thread about all that, just wanted to help you about the encoding side, there is a page on other thread with some Pinnacle mpeg2-stream codecs that work and (best part) save the parameters on the registry. I had to severely hack TVLibrary.dll to get it running because the mux-demux-mux part eats too much CPU, if you want take a look click and read below.

    FYI: In my case, the hacked part just takes TVCardAnalogBase and teaches BluildGraph to inject filters from a graphedit file hacked to simplify and remember filter parameters, nothing worth to publish its too messy, but the Pinnacle encoders made the magic easier because loading them (on grahpedit) and tweaking the properties page to encode on the fly is stored on registry and TVEngine uses the encoder that way on load.

    The thread about all this is here (look near the final mesg of the thread)

    https://forum.team-mediaportal.com/no_audio_video_pins_found_no_channel-t15772p2.html

    Hope it helps!
     

    Azazyel

    Portal Member
    February 17, 2007
    18
    0
    Home Country
    There must be an issue I can't see.

    I can play the timeshift and recordings with AC3Filter, but not ffdshow. As far as I can tell, the ATI Encoder has been working perfectly well, just ffdshow doesn't work with the mediaportal demux. I'll see if I can fiddle with the encoded audio format and get it working (I like using ffdshow, cause it outputs as SPDIF for me).

    The changes required are (All in TvCardAnalog/Base)
    1) In FindAudioVideoPins()

    Add

    Code:
    //Mod for Audio Capture
          if (_pinAnalogVideo != null || _pinAnalogAudio == null)
          {
          	Log.Log.WriteFile("analog:   find pins on audio capture filter");
          	//Try adding a capture source to the graph, and using the line in as the audio pin.
    	      string monikerAudioCpature = @"@device:cm:{33D9A762-90C8-11D0-BD43-00A0C911CE86}\Realtek AC97 Audio";
    	      IBaseFilter audioCapture = Marshal.BindToMoniker(monikerAudioCpature) as IBaseFilter;
    	      int hr = _graphBuilder.AddFilter(audioCapture, "Audio Capture");
    	      if (hr != 0)
    	      {
    	        Log.Log.WriteFile("analog:AddAudioCapture returns:0x{0:X}", hr);
    	        throw new TvException("Unable to add AddAudioCapture");
    	      }   
    	      _pinAnalogAudio = FindMediaPin(audioCapture, MediaType.Audio, MediaSubType.Null);
          }
    //End mod

    But modify it to grab the first Audio Capture Source (I just used the moniker for mine to speed it up)
    I havent looked at the cleanup, so there may need to be a global version of audioCapture (_audioCapture)

    2) Add a variable to indicate we don't need the demux/remux the stream again, and add it to the begining of AddMpeg2Demultiplexer (Early return), AddMpegMuxer (Early return) and AddTsFileSink (Use _filterAnalogMpegMuxer instead of _filterMpegMuxer (Can't just use _filterMpegMuxer because it is remade when the graph restarts))

    3) Change around the desired Audio/Video compressors (ATI works well and is free to download), and sort out muxer.

    Is there a reason for the mux-demux-remux? Can that be cut out entirely?
     

    fherrador

    Portal Member
    January 30, 2007
    28
    1
    63
    Home Country
    Spain Spain
    Can be cutted for sure but you will break the standarized pre built graph that MP uses to get when dealing with analog cards, in fact the routines to starttimeshift & record work, as you already know, expecting to mux to a tsink and this is common for digital & analog, but, to answer you question, yes it can be done (i did it my (dirty) way). But a major rewrite of several areas is needed. Unfortunately right now i'm figthing with another weird problem on my system with AMStream rejecting to change capture pin resolutions telling me "unknown medyatype" with the lastests svns that is stopping me to advance on a solution without breaking other card combinations + MP functions, just think on the miriad of combinations that must be covered to make it universally applicable to any kind of analog thingy arround.

    A hint that may help you debug your particular sollution... Use FilterGraphTools.SaveGraph to take a look to the running graph files generated by that method before/after starting timeshift/record, this will clearly tell you that cutting and rebinding some pins will do the trick, also gives you a tool to validate your particular filter combination before running the real thing. (For an unknown reason to me, adding the graphbuilder to ROT doesnt gives graphedit the ability to connect to that remote graph that TVEngine is using, go figure why..... :-(

    On (3), each compressor has their own way to handle settings so a common way to do it will be very difficult to universalize. I just did my own solution by loading a previously saved graph file whit the single filter needed (encoder). I will post the code if you are interested on that. No time now sorry...
     

    Azazyel

    Portal Member
    February 17, 2007
    18
    0
    Home Country
    I've phrased my words rather ambiguously, I'm sorry.

    I was actually asking if the mux-demux-remux is needed, not if it is possible to remove. And for 3) I was saying the filter priority should be looked at (Most compatible filters first, or something), not the filter settings.

    Supplying an encode graph seems like a good way to set things up, as there is no control over encoders, muxers and audio capture atm. To add it will require modification of the RemoteControl section to pass the settings to the Analog form, and then to pass them back.

    I'm still trying to work out why the audio won't play in media portal, even though it plays perfectly in external programs.

    And I still don't know what to do about submitting my changes. Cause I'm fine just hacking it to work for me and leaving it there ;) But I would like to contribute.
     

    fherrador

    Portal Member
    January 30, 2007
    28
    1
    63
    Home Country
    Spain Spain
    Needed hmm?

    Needed, well, I don't think so, but, going on with your case. Have you tryed to extract the running graph to check if sound is really getting into the muxer, or at least being selected on the xbar?.

    This is my StartTimeShifting() test method on TVCardAnalog.cs

    public bool StartTimeShifting(string fileName)
    {
    if (!CheckThreadId()) return false;
    Log.Log.WriteFile("Analog: StartTimeShifting()");
    if (_graphState == GraphState.Created)
    {
    FilterGraphTools.SaveGraphFile(_graphBuilder, "CreatedStartTimeShifting.grf");
    string extension = System.IO.Path.GetExtension(fileName).ToLower();
    StopGraph();
    AddMpegMuxer(_currentChannel.IsTv);
    AddTsFileSink(_currentChannel.IsTv);
    SetTimeShiftFileName(fileName);
    }
    FilterGraphTools.SaveGraphFile(_graphBuilder, "StartTimeShifting.grf");
    _capBuilder.SetFiltergraph(_graphBuilder);
    //*******
    _rotEntry = new DsROTEntry(_graphBuilder);
    RunGraph();
    FilterGraphTools.SaveGraphFile(_graphBuilder, "RunningStartTimeShifting.grf");
    _graphState = GraphState.TimeShifting;
    _lastSignalUpdate = DateTime.MinValue;
    //FileAccessHelper.GrantFullControll(fileName);
    _tunerLocked = false;
    return true;
    }

    This way you will have the pre-rendered graph on _graphBuilder on the first file, just after adding mux & tsink on the second and the running graph on the third. Load that one and inspect carefully how the wiring and specially the properties pages and pin properties of the faulty path. Try to run it without poping errors (wont get anything displayed just the .ts files will be created on the tshift folder).

    Almost forgot, if you go to channels list on setuptv and preview a channel (analog), graphedit can "connect to remote graph" and get a graph that will get the timesinkfile contents played on a window, save it for future tests. Then change it & re-graph with your preferred (working) decoders there, SetupTV uses MPV and MPA as default if you have also the full MP installed on that machine and i also had audio issues with MPA = no sound depending on the Audio Layer II encoder used, solved that using the cyberlink versions for my ATI Radeon that plays it all)

    Hope all this helps you in any way, if not, post the captured graph, this way the rest of the crew will have a better scenario to figure what is happening.
     

    Users who are viewing this thread

    Top Bottom