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. C#
  4. Video Merging using Splicer Lib

Video Merging using Splicer Lib

Scheduled Pinned Locked Moved C#
tutorialmobiledata-structureshelpquestion
5 Posts 3 Posters 0 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.
  • K Offline
    K Offline
    Kasun Lee
    wrote on last edited by
    #1

    Hi. I tried to merge two videos into one using Splicer library. When I ran the code (below), the code got non-responsive, so after awhile I stopped the code from executing. The resulting file (which was created by the code while it has became non-responsive) was over 11GB. I'm not sure how to fix that. Could anyone guide me please? Thanks.

    --------
    //Create a string array to store file paths
    string[] filepaths = new string[10];
    filepaths.SetValue(textBox_Source1.Text, 0);
    filepaths.SetValue(textBox_Source2.Text, 1);
    //Call the video merging function
    MergeVideos(filepaths, filepaths[0] + "_merged");


    using (ITimeline timeline = new DefaultTimeline())
    {
    IGroup group = timeline.AddVideoGroup(32, 720, 576); // Set bitrate, width, height

    var firstClip = group.AddTrack().AddVideo(videoPaths\[0\]);
    var secondClip = group.AddTrack().AddVideo(videoPaths\[1\], firstClip.Duration /\* offset \*/);
    
    using (AviFileRenderer renderer = new AviFileRenderer(timeline, outputFilePath))
    {
        renderer.Render();
    }
    

    }

    D OriginalGriffO 2 Replies Last reply
    0
    • K Kasun Lee

      Hi. I tried to merge two videos into one using Splicer library. When I ran the code (below), the code got non-responsive, so after awhile I stopped the code from executing. The resulting file (which was created by the code while it has became non-responsive) was over 11GB. I'm not sure how to fix that. Could anyone guide me please? Thanks.

      --------
      //Create a string array to store file paths
      string[] filepaths = new string[10];
      filepaths.SetValue(textBox_Source1.Text, 0);
      filepaths.SetValue(textBox_Source2.Text, 1);
      //Call the video merging function
      MergeVideos(filepaths, filepaths[0] + "_merged");


      using (ITimeline timeline = new DefaultTimeline())
      {
      IGroup group = timeline.AddVideoGroup(32, 720, 576); // Set bitrate, width, height

      var firstClip = group.AddTrack().AddVideo(videoPaths\[0\]);
      var secondClip = group.AddTrack().AddVideo(videoPaths\[1\], firstClip.Duration /\* offset \*/);
      
      using (AviFileRenderer renderer = new AviFileRenderer(timeline, outputFilePath))
      {
          renderer.Render();
      }
      

      }

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      The only person who's going to be able to "guide you" on this is the person(s) who wrote the Splicer library. As far as I can tell, there is no documentation on it that survives anywhere and the project on GitHub hasn't been touched in the last 6 years. It appears to be abandoned.

      Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

      1 Reply Last reply
      0
      • K Kasun Lee

        Hi. I tried to merge two videos into one using Splicer library. When I ran the code (below), the code got non-responsive, so after awhile I stopped the code from executing. The resulting file (which was created by the code while it has became non-responsive) was over 11GB. I'm not sure how to fix that. Could anyone guide me please? Thanks.

        --------
        //Create a string array to store file paths
        string[] filepaths = new string[10];
        filepaths.SetValue(textBox_Source1.Text, 0);
        filepaths.SetValue(textBox_Source2.Text, 1);
        //Call the video merging function
        MergeVideos(filepaths, filepaths[0] + "_merged");


        using (ITimeline timeline = new DefaultTimeline())
        {
        IGroup group = timeline.AddVideoGroup(32, 720, 576); // Set bitrate, width, height

        var firstClip = group.AddTrack().AddVideo(videoPaths\[0\]);
        var secondClip = group.AddTrack().AddVideo(videoPaths\[1\], firstClip.Duration /\* offset \*/);
        
        using (AviFileRenderer renderer = new AviFileRenderer(timeline, outputFilePath))
        {
            renderer.Render();
        }
        

        }

        OriginalGriffO Offline
        OriginalGriffO Offline
        OriginalGriff
        wrote on last edited by
        #3

        To add to what Dave has said, if you are recoding videos in order to join them together (and unless they have the same resolution, same frame rate, same codecs, and a very similar bit rate that is exactly what you have to do to get a working file) then it's going to take some significant time - we are talking hours here for 4K videos, even on a powerful machine, using well optimised software. The partial file size of 11GB isn;t that surprising in the context of the bitrate you appear to be requesting: is that "32" generating a 32K bitrate? If so, then the file size is going to be pretty huge and will take a long time to process. Grab a free copy of XMedia Recode[^] (it's one of the tools I use for such jobs) and see how long it takes and the resulting video file size.

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

        K 1 Reply Last reply
        0
        • OriginalGriffO OriginalGriff

          To add to what Dave has said, if you are recoding videos in order to join them together (and unless they have the same resolution, same frame rate, same codecs, and a very similar bit rate that is exactly what you have to do to get a working file) then it's going to take some significant time - we are talking hours here for 4K videos, even on a powerful machine, using well optimised software. The partial file size of 11GB isn;t that surprising in the context of the bitrate you appear to be requesting: is that "32" generating a 32K bitrate? If so, then the file size is going to be pretty huge and will take a long time to process. Grab a free copy of XMedia Recode[^] (it's one of the tools I use for such jobs) and see how long it takes and the resulting video file size.

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

          K Offline
          K Offline
          Kasun Lee
          wrote on last edited by
          #4

          Thanks. The two files I'm trying to merge are around 30MB each. I'm actually not that familiar with working videos in C#, just playing around and testing here. Anyways, a video merger like Wondershare would take less than 5 mins to do it, and the resulting video would be less than 100MB. I'm not sure how to properly do that.

          OriginalGriffO 1 Reply Last reply
          0
          • K Kasun Lee

            Thanks. The two files I'm trying to merge are around 30MB each. I'm actually not that familiar with working videos in C#, just playing around and testing here. Anyways, a video merger like Wondershare would take less than 5 mins to do it, and the resulting video would be less than 100MB. I'm not sure how to properly do that.

            OriginalGriffO Offline
            OriginalGriffO Offline
            OriginalGriff
            wrote on last edited by
            #5

            Check the bitrate on the result file from wondershare (windows explorer will show you that) and use VLC to check the codecs the result file contains - H265 for example is a lot more compact than H264 for example, but not everything can read it. But as Dave said, that one would appear to be abandoned - and that may be because it was never finished, or had bugs, or ... you never know. You know you can splice files directly using FFMPEG as an external process? Concatenate – FFmpeg[^]

            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
            "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

            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