VideoHelp Forum

Try DVDFab and download streaming video, copy, convert or make Blu-rays,DVDs! Download free trial !
+ Reply to Thread
Results 1 to 9 of 9
Thread
  1. Member
    Join Date
    May 2009
    Location
    United States
    Search Comp PM
    I've got several hundred 1080p60 H264 video files with .MTS file extension. Since it doesn't seem as though they will be playable under any normal circumstance, I am going to be forced to re-encode each one of them as something less demanding to play, and then replace them one by one in Premiere Pro after all the editing is done.

    What I don't relish is the workflow as I envision it, which goes something like this:

    1) For each of the 300+ individual files, create individual .AVS files.
    2) In each of these 300+ .AVS files, specify a particular filename like so:
    Code:
    directshowsource("file.mts")
    3) Load each of these 300+ unique .AVS files into VirtualDub, one by one, and queue a batch operation to encode as something else.

    Now, this is just silly. There has to be a better way. Were VirtualDub able to load the .MTS files natively, that would cut the workload by about 60% right there. Or perhaps there is something which could be done on Avisynth's end to reduce the need for 300 different .AVS files with different text in each one of them. I don't know. That's why this is a newbie question. ;p
    Quote Quote  
  2. there are a bunch of tools; search google for "avisynth batch script creator"

    "khaver" has written some tools for this as well. Search for "khaver batch intermediate creator". You can batch encode proxies as well (ffmpeg based)
    Quote Quote  
  3. Try putting this batch file in your SendTo folder. Then you can right click on any file and select SendTo -> Recode.bat. It will use x264 to renencode to an MKV file with half the dimensions (1920x1080 -> 960x540). Of course, you can change the batch file to match your needs. Maybe use SelectEven() instead of resizing. Or make an MP4 instead of MKV.

    Originally Posted by Recode.bat
    echo DirectShowSource("%~d1%~p1%~n1%~x1") > "%~d1%~p1%~n1.avs"
    echo BilinearResize(width/2, height/2) >> "%~d1%~p1%~n1.avs"
    x264.exe --preset=veryfast --crf 18 --ref 3 --bframes 2 --keyint 100 --sar 1:1 --output "%~d1%~p1%~n1.mkv" "%~d1%~p1%~n1.avs"
    DEL "%~d1%~p1%~n1.avs"
    On a quad core CPU you'll probably find this encods faster than using Xvid+VirtualDub and will deliver better quality and a smaller file size.

    You can also call this from another batch file. Say, to process every file in a folder.

    Oh, you'll probably also want to mux in the original the audio. You can use MkvMerge for that. If you start MMG and setup a mux you can use the Copy to Clipboard function to see the command line parameters to be used.
    Last edited by jagabo; 9th May 2011 at 22:04.
    Quote Quote  
  4. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    I love Avisynth, but I use it because I can use it to edit, filter and transform the file in various ways by script.

    If you're just doing a format conversion, use something like XMediaRecode and make a profile for what you want to get. Then you can do them all in a batch.

    If you're a hardcore scripter, use ffmpeg command line. It can convert anything to anything in one line.
    Quote Quote  
  5. Member
    Join Date
    May 2009
    Location
    United States
    Search Comp PM
    Originally Posted by jagabo View Post
    Try putting this batch file in your SendTo folder.
    That's an astonishingly nifty script. (Once I figured out where I could put x264.exe to force Windows to find it.) The result is quite acceptable indeed. But I encountered the same issue I've been having with (I assume) Avisynth all day. It's failing to properly handle the AC3 5.1 audio which these videos contain. Said audio plays back properly when viewing the original videos in a media player, so it's definitely there. But after it passes through Avisynth, it turns into six channels of complete silence (confirmed with Adobe Audition). Unfortunately, your script doesn't force Avisynth to play any nicer.

    Originally Posted by jagabo View Post
    Oh, you'll probably also want to mux in the original the audio. You can use MkvMerge for that. If you start MMG and setup a mux you can use the Copy to Clipboard function to see the command line parameters to be used.
    This sounds like it would do the trick. But I need to stress the fact that I'm dealing with hundreds of small video clips, and I'm trying very hard not to go insane from a seemingly unavoidable 10-hour video "assembly line" scenario like performing several individual processes on each of the files.

    It's starting to look like my best bet will be to find a way to losslessly merge all of the hundreds of clips into one big file. At this point, I will take it. Heck, it may ultimately make things easier. They're H264+AC3 1080p60 MTS files at 28Mbps. I am aware of at least one pay solution. But I figure it's such an uncomplicated task that somebody probably already slapped it together for free in a lazy afternoon.

    Originally Posted by AlanHK View Post
    If you're just doing a format conversion, use something like XMediaRecode and make a profile for what you want to get. Then you can do them all in a batch.
    Just to see if this program dealt with the AC3 audio better, I gave it a shot. Unfortunately, it crashed. ;p But the suggestion was certainly very much appreciated.
    Quote Quote  
  6. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    Post one of your videos here (if small enough) or on a filesharing site so we know what we're talking about.

    There are other ways of loading AC3 into Avisynth than DirectShowSource for one thing.

    Or if you can play the audio as-is, just extract and mux it with the new video.
    Quote Quote  
  7. Originally Posted by Asterra View Post
    I encountered the same issue I've been having with (I assume) Avisynth all day. It's failing to properly handle the AC3 5.1 audio... I'm dealing with hundreds of small video clips, and I'm trying very hard not to go insane from a seemingly unavoidable 10-hour video "assembly line" scenario
    You can modify the script to demux the audio from the source file into the final MKV. Then use another batch file to automate the entire group of files:

    for %%a in ("*.avi") do recode "%%a"
    Obviously, change "*.avi" to whatever file type you have. I'll leave the MkvMerge Syntax up to you!

    Or, as AlanHK suggests, you can use ffmpeg after working out the necessary command line.

    for %%a in ("*.avi") do ffmpeg "%%a" yada yada yada
    Quote Quote  
  8. Are these from PannyTM-700 ? 1080p60 ?

    Why are you using avisynth? are you using other filters ?

    Might be easier to use ffmpeg and just copy the audio

    mpeg2 i-frame is very easy resource wise (smooth to edit)

    1280x720p60 I-frame mpeg2 might be a good proxy. Go smaller resolution if you want , just change the -s parameter. Use lower qscale to get higher bitrates, higher qscale to get lower bitrates. 5-7 might be a good starting point

    1) place copy of ffmpeg in same folder as files to convert

    2) write the following in notepad, save it, change extension from .txt to .bat


    for %%a in ("*.m2ts") do ffmpeg -i %%a -vcodec mpeg2video -s 1280x720 -qscale 5 -intra -acodec copy -f mpegts %%~na.new.m2ts

    pause
    3) double click the .bat file


    This will append "new" to the output proxy files. Use a batch renamer when relinking the real files in premiere, or batch rename the proxies and keep the "master" separate from the "proxy" in separate folders (if they have the same name and extension, you just have to pick the 1st one and all of them will be automatically swapped when relinking the files)
    Last edited by poisondeathray; 10th May 2011 at 00:30.
    Quote Quote  
  9. Member
    Join Date
    May 2009
    Location
    United States
    Search Comp PM
    Originally Posted by poisondeathray View Post
    Are these from PannyTM-700 ? 1080p60 ?
    Why are you using avisynth? are you using other filters ?
    Pretty sure that's the camcorder, yes. I was using Avisynth because Virtualdub couldn't load the files natively. I did use a bicubicresize, but I also tried it without the filter. As far as I could tell, Avisynth was simply not handling the audio correctly. I was aware of a version of Avisynth 2.5 with a direct stream copy feature, but I really, really did not want to juggle more versions of Avisynth after all the headaches which ensued during my attempts to get multithreading working, and my subsequent triumph in returning to a stable, functional install.

    Originally Posted by poisondeathray View Post
    2) write the following in notepad
    Boom. Simple as that, the solution to my woes is in hand.

    All that remains is to confirm within Premiere Pro that both the original and the post-ffmpeg versions of the videos share the same luma values (for the most part) and total frames (because, in my experience at least, interframe video is dodgy in this regard, and converting one to another only enhances this concern).
    Quote Quote  



Similar Threads