Log in

View Full Version : how to merge 4 files while encoding them ? & how to crop a part from a video


I-IEMA
22nd December 2010, 21:57
hello guys ,

I have a video divided to 4 asf files

& want to encode them to mkv & merge them while converting ,, is that possible ? How ?

How to crop a part from the video in the converting ?

I've tried to do that & croped the video only while the audio stills & become out of sync :( .

how to crop both audio & video ?

last Q :) :
How can I encode only a 5 mins from a video ,, to see how the quality come up ?

thanks for your help ,,
& merry Xmas :) .....

yetanotherid
28th December 2010, 17:43
There's probably technically better ways to do it but as I don't think either of the conversion programs I use regularly open asf files (MeGUI or AutoGK) I'd probably use AnyVideoConverter (the free version). You can load the 4 asf files into the program, select which parts of each one to convert, then highlight all four and select "merge". You should, with any luck, end up with a single file in the format of your choice.

If you need more precise editing than to the nearest second, you could convert each file individually to a lossless format (they'll be big files but you don't lose more quality through converting twice). I use huffyuv compression inside an AVI file. You can download and install the codec here (for playback) huffyuv (http://www.afterdawn.com/software/audio_video/codecs/huffyuv.cfm)
Once you have your 4 files converted to lossless AVIs using AnyVideo Converter you can open them with VirtualDub, edit them frame by frame, resave them and finally merge the 4 edited AVIs into a single file. From there you can pretty much use whichever program you prefer to convert the final AVI to MKV.

There's ways around having to open and edit the uncompressed AVIs themselves if they're really big and resaving them takes forever, and you could probably open and edit the asf files with VirtualDub via a frameserver, but as it involves frameserving and AVISynth scripts and it can melt your brain before you get it working properly, for a single job it's probably not worth the learning curve.

yetanotherid
28th December 2010, 19:32
Well you got me thinking.... because I'm in the middle of trying to edit and convert some problem files myself..... so I started thinking of better ways to do it and now I've got what seems to be the easiest way worked out. It doesn't take long to set up (well it might take a bit the first time) and the programs you need (free and easy to find) are:

MeGUI (update it after installing)
AVISynth 2.5 (I think it installs with MeGUI but if not install it separately)

Media Player Classic Home Cinema and ffdshow might be useful too.

I don't have any asf files on my PC but I tried this with a couple of wmv files so it should work for asf files too.
Put all four files in one folder. Assuming they're called part1.asf, part2.asf, part3.asf & part 4.asf

Open notepad and copy and past the following into it:

alignedSplice(DirectShowsource("part1.asf"),DirectShowsource("part2.asf"),DirectShowsource("part3.asf"),DirectShowsource("part4.asf"))

Now save the above in the same folder as your files (if you don't you need to include the full path to each file instead of just using the file names) but give it the extension .avs instead of .txt
So now you should have a little AVISynth script using the AVISynth icon saved in the same folder as the video files. Open Media Player Classic, then File/Open etc and open the AVS script. If there is a God, MPC should now open the four parts as a single video, courtesy of the AVISynth frameserver. Now to edit and convert it....

Open MeGUI, click on the box to the right of the AVISynth Script address bar and open your avs file (you might want back it up somewhere else first in case you mess things up and want to start again). Once it's loaded go to the Tools menu at the top and select AVS Cutter. Load the same avs script into the cutter. A preview window will open up and should display the four parts as one, the same as MPC did. The top of the preview window shows the current position by frame. Just use the navigation bar to set your cut points... well they're actually "keep points" because you add the stuff you want to convert rather than the stuff you want to get rid of. You should work it out easy enough. Once you've found a start and end point go back to the cutter window and add them, then do the same for the next section you want to keep and so on..... when you've added them all, hit "save cuts to script" and close out the AVS Cutter.

That's the hard stuff done. Go back to MeGUI and set up your encoding for the video etc. When that's done load the same avs script you've been using for the video as the audio input too. Select the format for converting the audio etc but if you go into the encoder options don't select "force decoding via directshow" because it won't work and you're already doing so anyway.

With the audio also set up, click on the AutoEncode button at the bottom and click your way through the options. When it's finished switch to the MeGUI Queue tab and then hit Start at the bottom. MeGUI should encode the audio according to your cut points, then the video, and when it's done it'll mux them both into an MKV (or whatever container you chose).

If you try the above method let me know how you go. Even if you don't, at least you finally prompted me to work out a better way to edit and convert my problem files.
I did read something in the AVISynth help files about asf files being problematic sometimes... apparently they can't decode faster than real time so the conversion process may be slow, and apparently they mightn't identify their frame rate properly so you have to specify it.
http://avisynth.org/mediawiki/DirectShowSource#My_ASF_renders_start_fast_and_finish_slow
If the frame rate doesn't seem to be right add this as a second line to your original AVISynth script (obviously changing the frame rate to whatever the original video might be):
AssumeFPS(23.976)

Good luck.

PS. The above really only lets you select the bits you want to convert and convert them. It doesn't let you do other stuff like resizing, cropping black bars etc. For that you'd need to go through one more process. You still load the avs script using the AVS cutter and save your cut points etc, but then from the MeGUI Tools menu you select AVS Script Creator. When it's opened load your avs script as a video input file. MeGUI will then import it into the new script it creates after you setup your resizing and cropping options etc using the Script Creator (which opens a preview window). Once your done hit save and MeGUI will load the new script into the main window for converting as before.
It probably sounds a lot more complicated than it is if you haven't used MeGUI before, but it probably won't seem too bad once you've got MeGUI running in front of you.... and I've done enough typing for one day.