Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Well, it has been a few days researching on a suitable auto or semi-automatic way of mass merging files this way. Basically, what I want to achieve is inserting the same clip, before a bunch of other clips.

In this case I´ve been trying with .flv, .mp4, .avi files (always merging same codecs), and I didn´t succeed after testing all the programs available in both Windows and OSx. Believe me, I´ve tried them all. The only ones which are supposed to handle quite well this quite of tasks are from Videocharge: Watermark Master and Videocharge Studio. None of them could perform correctly the task. Maybe there was some way I could have achieved this by scripting with After Effects or Sony Vegas, I just didn´t find any.

Now I´m trying to find some way to achieve the same thing either by shell, unix scripting... I don´t care. I just don´t want to mount Ubuntu only for these tasks. I´m not a programmer, but I´m quite stuborn (which sometimes leads me to neverending nights) so I would appreciate some help or guidance from anyone keen and good enough on batch video processing or scripting.

Right now, the only useful paths I´ve found drive me into either using mencode or ffmpeg through commands, but I am not able to perform the merge on batch. I don´t care about the way to sort the videos out. But taking into consideration that the operation would be performed on hundreds or thousands of videos, it wouldn´t be suitable to have them all in separate folders each accompanied by the "unique" intro clip. I guess that the most logic way would be storing the "bunch" videos in a folder, and the intro clip on the same folder as the encoder or renderer.

Thanks in advance for any help or guidance,

share|improve this question
    
first you should increase your video knowledge: container, tracks, codecs. encoding & muxing. look at a video forum. –  Endoro Jun 9 '13 at 15:07
    
See the FFmpeg documentation on the concat demuxer and also How to concatenate (join, merge) media files. –  LordNeckbeard Jun 10 '13 at 18:59
add comment

2 Answers 2

Well, I've appended videos, but never appended at the beginning. You can use avidemux to append the videos!

I'm not good at javascripting, so please excuse me for not scripting this for you. There's a tutorial for scripting for Avidemux. Avidemux is an open source and free video converter. You can add effects to your audio/video in avidemux and save it to multiple formats.

This script is an example tutorial on the page link given here: [ ::: link ::: ] and the script will simply scan the orgDir directory and unpack all AVI files. The resulting file is put in destDir directory (Using new directorySearch API).

Avidemux functions are as follows: displayError, displayInfo, fileReadSelect, fileWriteSelect, allFilesFrom, nextFile

and more functions: load, append, save, saveDVD, saveOGM, clearSegments, addSegment, goToTime, forceUnpack, setContainer

More Script Functions here: http://www.avidemux.org/admWiki/doku.php?id=using:scripting#avidemux_functions

the Turotial Script that converts the avi file is as follows:

//AD  <-
/*
      Simple script that scans the orgDir directory
      and unpack all AVI files
      The resulting file is put in destDir directory
      Using new directorySearch API
*/
var app = new Avidemux();
var ds = new DirectorySearch();
var orgDir;
var destDir;
var reg =new RegExp(".$");
/*
      This is for Unix
      For Windows change to
      sep="\\";
      reg2=new RegExp("\\.*\\");
*/
var sep="\\";
var reg2 =new RegExp("\/.*\/");
var extension;
var target;
//
//
//
//      select files from original & target directories
//
      orgDir=fileReadSelect();
      destDir=fileWriteSelect();
      orgDir=pathOnly(orgDir);
      destDir=pathOnly(destDir);
//
//      strip last \\ or //
//
      orgDir=orgDir.replace(reg,"");
      destDir=destDir.replace(reg,"");
      print("orgDir : <"+orgDir+">");
      print("destDir : <"+destDir+">");
//
// Go
//
if(ds.Init(orgDir))
{
  while(ds.NextFile())
  {
      // Only process file we want i.e. AVI
      if(!ds.isNotFile && !ds.isDirectory && !ds.isHidden && !ds.isArchive && !ds.isSingleDot && !ds.isDoubleDot)
      {
          extension=ds.GetExtension();
          if(extension == "avi")
          {
              target=ds.GetFileName();
              target=destDir+sep+target;
              print("***"+ds.GetFileName()+"-->"+target);
              processFile(orgDir+sep+ds.GetFileName(),target);
              }
          //print("File: "+ds.GetFileName()+" is "+ds.GetFileSize()+" bytes, extension "+extension);
      }
  }
  print("We just searched in directory \"" + ds.GetFileDirectory() + "\"");
  ds.Close();
}
else
  displayError("Error initializing the directory search");
displayInfo("Finished !");
function processFile(filename, targetfile)
{
      // Load the file
      app.forceUnpack();
      app.load(filename);
      app.rebuildIndex();
      app.audio.delay=0;
      app.audio.mixer("NONE");
      app.audio.scanVBR();
      app.setContainer("AVI_UNP");
      app.save(targetfile);
      return 1;
}

Hope this helps...

sources:

share|improve this answer
    
Welcome to Super User! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  terdon Jun 9 '13 at 13:24
    
ok. sorry for that... I'll edit my answer... –  mk117 Jun 9 '13 at 14:59
add comment

Cheers a lot for your suggestion @user2377276. I really appreciate the effort. In fact, your workaround is the one which is guiding me in the right direction. Well, I hope so, as I haven´t suceeded yet. So far, the closest I´ve got to accomplish the merge was through different variation of the following code, executed in the same directory as the multiple different videos. The unique file to append was placed in the root, and I created C:/TEMP for the output.

for %a in ("*.flv") do Mencoder -oac copy "c:\INTRO.flv" "%a" -o "c:\TEMP\%a"

All videos are in FLV1, but they do have slightly different resolution, so I´m getting crap, basically.

I don´t know if I should try with ffmpeg. Suggestions?

I´m pretty sure that this can be achieved without the need to reencode, as I have tested several programs and none of them are reencoding, they are just forcing the resolution in some cases. In fact, the program that seemed to behave the best was the AIR application Rich Flv, but it doesn´t work on batch.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.