Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Graphics
  4. Avi Compression

Avi Compression

Scheduled Pinned Locked Moved Graphics
tutorialcomhelpquestionannouncement
10 Posts 2 Posters 7 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mjmim
    wrote on last edited by
    #1

    After Mark Salsbery showed me the wonders of DirectShow Editing Services (Thanks Mark!) i was able to take a bunch of mpegs, put them on after the other and add background music and save the output to an avi file. One problem. I am having problems Compressing it. The output file is huge since i am not compressing it. The following example from the DirectShow documentation shows this: long NumGroups; pTimeline->GetGroupCount(&NumGroups); // Loop through the groups and get the output pins. for (i = 0; i < NumGroups; i++) { IPin *pPin; if (pRender->GetGroupOutputPin(i, &pPin) == S_OK) { IBaseFilter *pCompressor; // Create a compressor filter. (Not shown.) // Set compression parameters. (Not shown.) // Connect the pin. pBuilder->RenderStream(NULL, NULL, pPin, pCompressor, pMux); pCompressor->Release(); pPin->Release(); } } They do not show how to create a compression filter. So meanwhile my compressor is NULL, this is why my output is so huge. Anyone have any idea how to create a compressor filter? Show me some code xample? Thanks, Michael mjmimmm@hotmail.com

    M 2 Replies Last reply
    0
    • M mjmim

      After Mark Salsbery showed me the wonders of DirectShow Editing Services (Thanks Mark!) i was able to take a bunch of mpegs, put them on after the other and add background music and save the output to an avi file. One problem. I am having problems Compressing it. The output file is huge since i am not compressing it. The following example from the DirectShow documentation shows this: long NumGroups; pTimeline->GetGroupCount(&NumGroups); // Loop through the groups and get the output pins. for (i = 0; i < NumGroups; i++) { IPin *pPin; if (pRender->GetGroupOutputPin(i, &pPin) == S_OK) { IBaseFilter *pCompressor; // Create a compressor filter. (Not shown.) // Set compression parameters. (Not shown.) // Connect the pin. pBuilder->RenderStream(NULL, NULL, pPin, pCompressor, pMux); pCompressor->Release(); pPin->Release(); } } They do not show how to create a compression filter. So meanwhile my compressor is NULL, this is why my output is so huge. Anyone have any idea how to create a compressor filter? Show me some code xample? Thanks, Michael mjmimmm@hotmail.com

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      I had no idea that stuff actually worked!! ;) The only compressor that comes with directshow is for writing ASF (.wma,.wmv, etc) files. I believe MPEG-4 is built-in to that but other flavors of MPEG are license-protected. If you can live with an ASF file, a method is shown here (note you'll need the Windows Media Format SDK to use the WM ASF Writer Filter, which is a mux.writer combo filter): Writing a Windows Media File in DES[^] If you need to output MPEG-1, and you have a MPEG-1 mux filter, you should be able to add it to the graph before the file writer. I'm pretty sure we discussed this before but I'm not sure exactly how it works since I've never used any third-party filters. I would expect a mux filter to have multiple input pins and one compressed format output pin. Hope that helps a little! Mark

      "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

      1 Reply Last reply
      0
      • M mjmim

        After Mark Salsbery showed me the wonders of DirectShow Editing Services (Thanks Mark!) i was able to take a bunch of mpegs, put them on after the other and add background music and save the output to an avi file. One problem. I am having problems Compressing it. The output file is huge since i am not compressing it. The following example from the DirectShow documentation shows this: long NumGroups; pTimeline->GetGroupCount(&NumGroups); // Loop through the groups and get the output pins. for (i = 0; i < NumGroups; i++) { IPin *pPin; if (pRender->GetGroupOutputPin(i, &pPin) == S_OK) { IBaseFilter *pCompressor; // Create a compressor filter. (Not shown.) // Set compression parameters. (Not shown.) // Connect the pin. pBuilder->RenderStream(NULL, NULL, pPin, pCompressor, pMux); pCompressor->Release(); pPin->Release(); } } They do not show how to create a compression filter. So meanwhile my compressor is NULL, this is why my output is so huge. Anyone have any idea how to create a compressor filter? Show me some code xample? Thanks, Michael mjmimmm@hotmail.com

        M Offline
        M Offline
        Mark Salsbery
        wrote on last edited by
        #3

        I forgot to ask - What filter(s) are you using to write the AVI file?? Mark

        "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

        M 1 Reply Last reply
        0
        • M Mark Salsbery

          I forgot to ask - What filter(s) are you using to write the AVI file?? Mark

          "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

          M Offline
          M Offline
          mjmim
          wrote on last edited by
          #4

          Hey Mark, Nice to talk to you again.... I don't know how much experience you have with DirectShow Editing Services. The truth is i don't really know what filters i am currently using. I guess it automatically uses the default filters since i did not manually order it to use any specific filters. I have an open source mpeg-2 decoder and an open source ac3 filter (for the sound). I am guessing that underneath it uses the mpeg-2 splitter and both of these decoders for video and sound. For the mux, i saw that i have an avi muxer through the graphedit tool - didn't this come with windows? 1. Is is the avi muxer i have a third party tool? 2. Is there a way for me to definitely know which filters DES is using? 3. Do asf decoders come by default on windows systems? 4. The reason you think we already had this conversation was because in the past i wanted to ouput to mpeg-2, but there were no built-in muxers and now i have this avi-muxer "qcap.dll" if i recall correctly. 5. There is something called smart-rendering in DirectShow Editing Services have you had any experience with it?(ISmartRenderEngine). 6. In my other post i explained that my output file is huge because i am not compressing. I do not know how to create a compressor filter, not with the basicengine and not with the smartengine. Thanks, Michael mjmimmm@hotmail.com p.s. really sorry for the long post.

          M M 2 Replies Last reply
          0
          • M mjmim

            Hey Mark, Nice to talk to you again.... I don't know how much experience you have with DirectShow Editing Services. The truth is i don't really know what filters i am currently using. I guess it automatically uses the default filters since i did not manually order it to use any specific filters. I have an open source mpeg-2 decoder and an open source ac3 filter (for the sound). I am guessing that underneath it uses the mpeg-2 splitter and both of these decoders for video and sound. For the mux, i saw that i have an avi muxer through the graphedit tool - didn't this come with windows? 1. Is is the avi muxer i have a third party tool? 2. Is there a way for me to definitely know which filters DES is using? 3. Do asf decoders come by default on windows systems? 4. The reason you think we already had this conversation was because in the past i wanted to ouput to mpeg-2, but there were no built-in muxers and now i have this avi-muxer "qcap.dll" if i recall correctly. 5. There is something called smart-rendering in DirectShow Editing Services have you had any experience with it?(ISmartRenderEngine). 6. In my other post i explained that my output file is huge because i am not compressing. I do not know how to create a compressor filter, not with the basicengine and not with the smartengine. Thanks, Michael mjmimmm@hotmail.com p.s. really sorry for the long post.

            M Offline
            M Offline
            mjmim
            wrote on last edited by
            #5

            I have no problem sending you or posting you my entire class. It's not that much, that way i can show you the place where i am supposed ot have a compressor filter and instead i place NULL because i do not know how ot create one... Thnx michael mjmimmm@hotmail.com

            1 Reply Last reply
            0
            • M mjmim

              Hey Mark, Nice to talk to you again.... I don't know how much experience you have with DirectShow Editing Services. The truth is i don't really know what filters i am currently using. I guess it automatically uses the default filters since i did not manually order it to use any specific filters. I have an open source mpeg-2 decoder and an open source ac3 filter (for the sound). I am guessing that underneath it uses the mpeg-2 splitter and both of these decoders for video and sound. For the mux, i saw that i have an avi muxer through the graphedit tool - didn't this come with windows? 1. Is is the avi muxer i have a third party tool? 2. Is there a way for me to definitely know which filters DES is using? 3. Do asf decoders come by default on windows systems? 4. The reason you think we already had this conversation was because in the past i wanted to ouput to mpeg-2, but there were no built-in muxers and now i have this avi-muxer "qcap.dll" if i recall correctly. 5. There is something called smart-rendering in DirectShow Editing Services have you had any experience with it?(ISmartRenderEngine). 6. In my other post i explained that my output file is huge because i am not compressing. I do not know how to create a compressor filter, not with the basicengine and not with the smartengine. Thanks, Michael mjmimmm@hotmail.com p.s. really sorry for the long post.

              M Offline
              M Offline
              Mark Salsbery
              wrote on last edited by
              #6

              The AVI muxer comes with DirectShow. I have lots of experience with Windows Media Format (ASF) - that's what I use in my software. The Windows Media Format compression works well for my needs, including realtime streaming. I haven't used the AVI muxer but I know it is configurable for various compression settings. I see it uses the Video Compression Manager but I'm not sure what types of compressors are included with Windows - I'm looking into that. The Windows Media stuff comes with windows starting in XP. The SDK comes with (or you can download) a redistributable install package for previous Windows versions. Pretty much the same deal as DirectX installation (but alot smaller). I'll definitely take a look at your code - I'll send an email you can reply to. Mark

              "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

              M 1 Reply Last reply
              0
              • M Mark Salsbery

                The AVI muxer comes with DirectShow. I have lots of experience with Windows Media Format (ASF) - that's what I use in my software. The Windows Media Format compression works well for my needs, including realtime streaming. I haven't used the AVI muxer but I know it is configurable for various compression settings. I see it uses the Video Compression Manager but I'm not sure what types of compressors are included with Windows - I'm looking into that. The Windows Media stuff comes with windows starting in XP. The SDK comes with (or you can download) a redistributable install package for previous Windows versions. Pretty much the same deal as DirectX installation (but alot smaller). I'll definitely take a look at your code - I'll send an email you can reply to. Mark

                "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

                M Offline
                M Offline
                mjmim
                wrote on last edited by
                #7

                Hey Mark, I sent you an email with my code... take a look whenever you can. Thanks, Michael

                M 1 Reply Last reply
                0
                • M mjmim

                  Hey Mark, I sent you an email with my code... take a look whenever you can. Thanks, Michael

                  M Offline
                  M Offline
                  mjmim
                  wrote on last edited by
                  #8

                  I have succesfully created compression filters also for my audio and also for my video. The problem is that i do not know which codec to use now. The Divx codec that i have does not allow me to control the frame rate or quality because it does not support this. The codecs that do allow me to have control give me bad quality\file size ratio. What codec can i use will allow me to control the frame rate and quality for Avi compression and have a reasonable size for the output file. Reminder: i am compressing from mpeg-2 to avi. Thanks, Michael mjmimmm@hotmail.com

                  M 1 Reply Last reply
                  0
                  • M mjmim

                    I have succesfully created compression filters also for my audio and also for my video. The problem is that i do not know which codec to use now. The Divx codec that i have does not allow me to control the frame rate or quality because it does not support this. The codecs that do allow me to have control give me bad quality\file size ratio. What codec can i use will allow me to control the frame rate and quality for Avi compression and have a reasonable size for the output file. Reminder: i am compressing from mpeg-2 to avi. Thanks, Michael mjmimmm@hotmail.com

                    M Offline
                    M Offline
                    mjmim
                    wrote on last edited by
                    #9

                    More information on why i cannot use the Divx codec: When using the IAMVideoCompression:GetInfo on the codec it returns 0 for capabilities. Meaning that it does support controlling the codec through this interface and I cannot control the frame rate, quality etc.... Is there a way around this? or another codec that does allow me to control this? Thank you, Michael mjmimmm@hotmail.com

                    M 1 Reply Last reply
                    0
                    • M mjmim

                      More information on why i cannot use the Divx codec: When using the IAMVideoCompression:GetInfo on the codec it returns 0 for capabilities. Meaning that it does support controlling the codec through this interface and I cannot control the frame rate, quality etc.... Is there a way around this? or another codec that does allow me to control this? Thank you, Michael mjmimmm@hotmail.com

                      M Offline
                      M Offline
                      mjmim
                      wrote on last edited by
                      #10

                      Hey Mark, Haven't heard from you since i sent you the example code? I still appreciate any help i can get. Thnx, Michael mjmimmm@hotmail.com

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups