VirtualDub: save direct to MP4 (Fraps to YouTube) with external encoders

Discussion in 'Video Encoding' started by raffriff, Jan 18, 2013.

  1. raffriff

    raffriff Moderator Staff Member Site Contributor

    Not sure if your log is complete. Please save as a TXT file and attach.

    Where did you get your settings? Please attach those as TXT as well.
     
  2. I've exported fraps' avi files to an mp4 successfully using this guide not too long ago, now all of a sudden I get this error. I've tried reinstalling both fraps and virtualdub but it didn't fix the problem.

    The only thing I can think of that may have caused this is that I installed realtek's hd audio manager about a week ago, and thats about the same time that I had this error come up. Other than that, I have no clue why this won't work for me anymore.

    I hope these are the correct settings you were asking for. I'm a complete noob at this, so my apologies if these weren't quite what you were looking for.
     

    Attached Files:

  3. raffriff

    raffriff Moderator Staff Member Site Contributor

    The log file shows,
    AudioEnc: ERROR: could not open AAC encoder.
    ...but in the next line, the Nero banner appears, so it's obviously open. The only thing I can think of is that your Nero command line got corrupted somehow.

    Go to Options, External Encoders, Encoders Tab and open "A nero aac q035"
    Make sure command line is exactly:
    Code:
    -q 0.35 -ignorelength -if - -of "%(tempaudiofile)"
    I don't think it matters, but try Audio Compression "No compression (PCM)," and try a different output folder.
     
  4. Finally got this to work again. I messed around with the audio conversion option and changed the sampling rate of one of my recorded videos from 192 kHz to 48 kHz. I changed the precision to 16-bit with the high quality box checkmarked as well.

    Not sure why this did the trick, but everything is functioning properly atm. Could it be that the original sampling rate was too high?
     
  5. raffriff

    raffriff Moderator Staff Member Site Contributor

    I am sorry, I forgot about this issue, which was discussed previously here - NeroAAC seems to fail silently with sample rates higher than 48000 Hz.
     
    Thalmor Wizard likes this.
  6. raffriff

    raffriff Moderator Staff Member Site Contributor

    @Dan Conor , and anyone else interested:

    I have been using a better way to call external encoders lately, and haven't written too much about it yet. Instead of calling external programs directly, I call batch files, and the batch files call the programs. This has the following advantages:
    1. Error trapping. I can test the arguments being sent to the external programs and stop if any are not valid (for example, the sample-rate problem discussed above can be tested for, and processing can quit with a helpful error message in the log instead of quitting with no explanation)
    2. Log control. I can control what goes to the Virtualdub log, adding helpful error messages and hiding unhelpful messages. Some programs fill the log with useless 'progress' messages, causing important earlier messages to be lost.
    3. Complex processing. Doing things not possible with Virtualdub's settings alone.
    A few months ago, I wrote about this batch technique on the Virtualdub forum [here]. Now I use batch files for all external encoders, where possible (calling ffmpeg as a video encoder has not worked for me, so far).

    So [here] is a ZIP file with batch files & virtualdub profiles for the two encoders I use most often:
    • .mp4 out, bat->x264 video, bat->neroaac audio, bat->mp4box muxing
    • .mov out, ffmpeg/x264 video, bat->ffmpeg/PCM audio, bat->ffmpeg muxing + qt-faststart postprocessing.
    Unzip to C: (root folder). When unzipped you will have a folder tree like this:
    C:\
    VirtualDub_1-10-04\
    external_encoders\
    ffmpeg
    mp4box
    neroaac
    x264

    You don't have to move Virtualdub itself to this location, but you can if you wish.

    Install ffmpeg, mp4box, etc to the subfolders under "external_encoders." There will be download links in each subfolder.

    Open Virtualdub and import the two .vdprof files as explained in the top post.

    If you have unzipped to some other location besides "C:\VirtualDub_1-10-04," you will have to edit the program locations in the batch files, and edit the external encoder settings to point to the batch files.

    Now make a test encode and examine the log (View menu, Log). You will see some added information there, including time stamps, and actual command lines sent to each program.

    If you try this, please post feedback. Was it explained clearly? Did everything work OK?
     
    Last edited: Dec 9, 2013
  7. raffriff, thank you for your awesome guides! :)

    I have been able to successfully generate a test MP4 file from a 4gig FRAPS AVI file using both the
    "Raffriff's awesome VirtualDub tutorial" and the batch file method outlined above.

    As someone who has never used VirtualDub before, here are my comments/questions/mistakes/learnings as I followed the steps:
    I thought this meant 2 distinct/different .vdprof files from the first post - but I believe you meant fraps2.vdprof & mp4 x264 r18 709 +aac.vdprof ?
    Anyway, I just imported the mp4 x264 r18 709 +aac.vdprof file and deleted/discarded the fraps2.vdprof from my earlier test (also had to delete the stuff inside the encoders tab)

    I unzipped to B:\VirtualDub_1-10-04
    I copied the contents of VirtualDub into this folder (including all its subfolders).
    I edited each and every *.bat file in the external_encoders folder and modified C:\ to B:\ (I even did the ones I'd probably never use like ffmpeg and mov just to be consistent)
    The second part confused me a bit at first - I thought I was supposed to edit the actual encoder paths in VirtualDub (options -> external encoders -> encoders -> point to *.EXE). But this would defeat the purpose of having batch files :)
    I realized I have to edit the file "mp4 x264 r18 709 +aac.vdprof" to point to B:\\ instead of C:\\

    I have attached the log. Please ignore the error on the first line - I forgot to delete from the encoders tab when I was re-importing the vdprof file.


    is it possible to set this to 4.1 using external encoders, or does it not matter for youtube uploads? A google search showed this setting controls maximum bitrate -- probably not applicable to youtube uploads since it downsizes them anyway; just wanted to get your opinion

    Looks like you're using CRF=18 here, but CRF=19 in the first post - fraps2.vdprof. No issues, this is up to the user anyway.

    I'd like to use -q 0.55 here, but would I run into the issue of NeroAAC unable to handle high sample

    Lastly, if I followed the guide step-by-step (saving direct to MP4 and or/batch generated MP4), I noticed that I had already generated the MP4 file before going into the filters section. Are filters completely optional or are some/all of their settings covered in the .vdprof files?

    Thank you.
     

    Attached Files:

    • log.txt
      File size:
      3.2 KB
      Views:
      5
    Last edited by a moderator: Dec 30, 2013
  8. raffriff

    raffriff Moderator Staff Member Site Contributor

    Thanks very much for the feedback @regulat0r , it helps. Here's a more complete explanation below. Choosing not to install to the default location requires more steps, and a really complete explanation would be "TL;DR", so I hope this is good enough:

    INSTALLATION:
    1. Unzip [this file] to C: (root folder). When unzipped you will have a folder tree like this:
      C:\
      VirtualDub_1-10-04\
      external_encoders\
      ffmpeg\
      mp4box\
      neroaac\
      x264\
      .
    2. Download NeroAAC from [nero.com];
      Extract & copy neroaac.exe to C:\VirtualDub_1-10-04\external_encoders\neroaac
      (If you did not unzip to "C:", use the correct path to external_encoders\neroaac)
      .
    3. Download the latest x264 from [x264.nl];
      Copy x264.exe to C:\VirtualDub_1-10-04\external_encoders\x264
      .
    4. Download MP4Box from [videohelp.com];
      When installing, uncheck all components except "mp4box"
      (no idea what all those extra components are, but we don't need them)
      Install to C:\VirtualDub_1-10-04\external_encoders\mp4box
      .
    5. Download ffmpeg from [zeranoe.com]; (get the "32-bit, static" version)
      Download qt-faststart from [zeranoe.com];
      Copy executable file(s) (and any DLL's) to C:\VirtualDub_1-10-04\external_encoders\ffmpeg
      .
    6. Under external_encoders, you will find two *.vdprof files; import each one, one at a time:
      VirtualDub Options menu, External Encoders, Import
      .
    7. If your executable files are NOT in the default locations, edit the executable paths in all BAT files in the external_encoders\ folder. Edit in the "Configuration section" only, unless you know what you are doing:
      Code:
      ::** CONFIGURATION SECTION **
      set mp4box="C:\VirtualDub_1-10-04\external_encoders\mp4box\MP4Box.exe"
      ::** END CONFIGURATION SECTION **

    Installation complete! Now you have two new external encoder sets to choose from when you Export-> Using external encoder.
    • Encoder set: "mp4 x264 r18 709 +aac"
      • MP4 container, MP4Box muxer
      • x264 video - CRF 18 by default, but this can be changed (see below)
      • NeroAAC audio.
        .
    • Encoder set: "mov ff x264 r18 709 +pcm"
      • MOV container, ffmpeg muxer, qt-faststart
      • ffmpeg/x264 video. (Could have used x264.exe, but I want to demonstrate the technique for encoding video with ffmpeg - note batch files do not work here AFAIK)
      • ffmpeg/PCM audio
    Common encoder settings like quality level are set under VirtualDub's External encoder "Command arguments." This lets you use one BAT file for multiple encoders.

    For example, to make a new x264 encoder with a different quality/size tradeoff:
    1. Go to the Options menu, External encoders
    2. Go to the Configure External Encoders tab
    3. Click "V bat x264 r18 709" (for this example)
    4. Click Duplicate
    5. Click Edit
    6. Edit the Command Arguments. For this encoder, they are:
      %(width) %(height) %(fpsnum) %(fpsden) "%(tempvideofile)" 18 bt709
    7. Change 18 to 22 or some other number (see x264 help on "--crf")
    8. Give the new encoder a name. Suggest "V bat x264 r22 709"
    The meaning of all the arguments is explained (tersely) in the BAT files.

    USAGE:
    You use these new encoder sets just like before - see top post, "Usage" section.

    I highly recommend selecting a short clip ( mark start={Home}, mark end={End} ) for testing purposes, as most errors seem to crop up in the muxing stage - after audio & video compression have finished. It's very annoying to do a long encode and have it fail at the very end, so make sure the encode works with a short clip before doing the full video.


    re: Filter question. Filters are not unrelated to external encoders; they are saved with "configuration scripts" (*.vcf)
     
    Last edited: Dec 19, 2013
  9. Rafriff,
    encouraged by your post a was able to provide a timewarp to the good old Virtualdub that I love so much, but lacking to use it for a while due to his limited support for x.264 and MP4 containers...
    I was not aware of the introduction of external encoders to VD, which is a great thing !

    Moreover, as I´m on an i7, I was curious to get the Quicksync encoding running with VD as well. Tell you what: It works !
    OK, I´m aware of all this discussions arround quality... but if you need something really fast this is it.

    What you need guys ist the q.264 executables that are available at http://www.tetrachromesoftware.com/and is providing not only the SW but also a lot of information arround it.
    Whit q.264 instead of x.264 I ´m able to get +450 Frames/sec. encoding speed if no filtering is applied in VD. So for transcoding only you can feel the unleashed performance of a HW encoder.
    By applying filtering in VD, and that´s what it originally is built for, you start leveraging you CPU again, and this is the limiting factor. I can run up to 75 Frames/sec by applying my full chain of VHS-restauration filterchain, and my CPU is busy not more than 40% in peaks (VERY much depending on the filters you use in VD). Why VD filtering is not grabbing all CPU power remains a mystery to me for the moment, I allowed to use all cores etc. but still my machine is running at 40% max.

    Given the above, by using q.264, your encoding process is not longer the limiting factor, it´s VD filtering itself.

    Whether or not one loves x.264 over Quicksync, and there are some good reasons for it, I don´t want to debate. But if you are out for a efficient solution at the tradeoff of a little bit of less quality at same bitrates translating into some more filesize for the same quality (not REALLY a big deal) then you can give it a test. As we speak I´m archiving analoge VHS material, so ...

    Some experience and hints using q.264 with VD:

    - I have not introduced the "batch-file solution", so all experince is w/o that.
    - the tempvideofile-argument needs to be applied w/o quotes, otherwise an error on pipe-definition is being caused
    - the STDIN-argument in q.264 is -i -
    - QS is not supporting CRF actually, so if you work with this nice bitrate control in x.264 you need to be aware. DON´T mix-up CRF with CQP, which is supported, but the the rate-integers are not comparable (if you today use CRF 21 you will get a far bigger file and bitrate by applying CQP 21, of course...)
    - after some experiences and tests I´m now using AVBR as bitrate control, and define a target bitrate to it. Quite easy to configure that way, and frankly a analog VHS in PAL is looking already nice with a bitrate of 2500 in QS.
    - the -u specifies usecases, default is 4, less should optimize quality over speed, and vice-versa. Frankly I haven´t seen a big difference, confirmed by the easy to read test and the same URL http://www.tetrachromesoftware.com/q264Test1Analysis/q264test_1.html

    to give an example, a chain of arguments you can use could look like :

    -i - -p high -avbr -b 2500 -u 4 -srch %(height) -srcw %(width) -fps %(fps) -c YV12 -o %(tempvideofile)

    And in VD you just have to configer an encoder accordingly:

    upload_2014-1-10_11-7-58.png


    One caveat though: From time to time VD comes back with an error that it cannot start with the encoding. I found out that it is caused by the output-filename used.
    Cannot explain so far but it seems that spaces are not liked, and complicated filenames in principle not. Use a short and easy output filename and you are done.

    I hope this is helping the persons interested, and allow me to extend my thanks to Ryan Seghers who has provided us with q.264 as a prerequisite !
     
    raffriff likes this.
  10. one correction to my original mail:

    please ignore my statement regarding the tempvideofile argument w/o quotes, I was wrong with my assumptions here.
    I spoke to Ryan and he educated me on the fact that the argument definitely has to come with quotes, nothing to do with q.264 but with the wrapper.
    If you don´t use the quotes this confuses q.264 when encountering a blank in the filename, so this is the reason for the problems with the filenames in my case...

    So whatever has caused the pipe-definition to hold the quotes in charge of that was definitely wrong, sorry for that.
     
  11. Good afternoon!
    I am very glad that could find your forum. You very much helped me. But, I have one question. When I do bitrate control in the block for Prores, VirtualDub gives a mistake. Help to make, please, control of the necessary bitrate in the block for Prores. In a line of arguments I repeated your line, but, inserted value of bitrate ( -b 185M ). This way doesn't work... :( But, if to clean bitrate parameter, everything perfectly works...
    (It for the message of FFMBC ProRes is a little higher)

    "commandArguments": "-f rawvideo -s %(width)x%(height) -r %(fps) -i - -pix_fmt yuv422p -vcodec prores -qscale 1
    -b 185M \"%(tempvideofile)\"",

    I thank for the help!
     
  12. raffriff

    raffriff Moderator Staff Member Site Contributor

    @Takoj , you are very welcome. The problem here is probably due to changes to the command line interface in recent versions of ffmbc. What error message are you getting?

    I haven't used ffmbc lately, since ffmpeg now supports prores & dnxhd.

    Instead of -qscale 1 -b 185M, try -profile:v 3. This works for me with ffmpeg.
    See also, http://transcoding.wordpress.com/2012/01/29/prores-ffmpeg/
     
  13. There is an error in the script from Dropbox. On line 4 you will find:
    Code:
    [FONT=arial](fraps2)[/FONT]
    It costs me two days of try and error with your really good tutorial, before i've noticed those damn Font-Tags. *gg*

    Another hint:
    On my system, Win7 Home Premium, i have to start the installation of MP4Box as Admin. As normal user i will receive a lot off errors, because the intallation cannot unpack many files. After the installation of MP4Box, only checked MP4Box, there are many files i don't need.

    My simple Solution to get only the mp4box.exe: Using 7zip to open the installation file and only unpack the mp4box.exe.


    Sorry for my bad english, i'm german. ;)
     
    raffriff likes this.
  14. raffriff

    raffriff Moderator Staff Member Site Contributor

    So sorry! :eek: Thanks for telling me about it!
     
  15. Thank you very much for this guide/thread. I was able to use this information to create the external encoder set I wanted (mp4box, x264 video and qaac AAC audio).

    Question: When using Queue patch operation > Export using external encoder, is it possible to have the output name, or something that identifies the output file as the 'Dest' in the job list?
    Dest is empty when using the 'M mp4box' multiplex (or any external encoder) vs Save as Avi... for example.
     
    deardevildude19 and raffriff like this.
  16. raffriff

    raffriff Moderator Staff Member Site Contributor

    Hi Zemalf, I think you have found a bug. I reported it.
     
  17. Well,,,,,,,,,,,,,,,,finally it works

    Thank a lot

    Itzik
     
  18. hi, im new here. this tutorial seems really helpful.

    i have a video file and audio file with both being in flv format (really weird!) can i use this method to merge them and output them into one mp4 file?
     
  19. raffriff

    raffriff Moderator Staff Member Site Contributor

    VirtualDub can open an FLV video using the FFmpeg input driver, and Audacity can extract the audio from just about any video and convert it to WAV format. VirtualDub can then join the audio to the video with Audio from another file.

    This method is easy and lets you adjust audio sync if needed (Audio menu, Interleaving, Delay), but for simply combining audio with video, it's much faster to mux them with ffmpeg, if you don't mind using a command line.
     
  20. Thank-you raff, I'll try the command line, have never done it before though. :)
     
    raffriff likes this.

Share This Page