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

    I always load these filters....

    [EDIT - moved here]
     
  2. *****EDIT**** - Hmm somethings wrong I looked at the details of the video file and the audio is 89kbps, Video seems fine at 15000kbps~ Any ideas why the audio messed up? The original fraps audio is 1536kbps.
     
  3. raffriff

    raffriff Moderator Staff Member Site Contributor

    The only place I have "128" or "44100" in my settings is in the description, not the actual commands. I found better settings, changed them and forgot to update the description. Sorry about that, it happens!
    (EDIT 6/21 - the description has been changed again to simply "MP4," to work around a quirk in VirtualDub 1.10.3 where the "Export..." dialog box, under "Save as type," shows the encoder set description and not its extension.

    The Nero AAC command line now sets "constant quality" encoding, not "constant bitrate."
    That way you save some bits if the encoder decides you don't need them. One reason why AAC is better than MP3. Some of my videos have bitrates in the 70-80 kbps area and they sound fine.

    Approx. average bitrate <-> Quality table
    http://www.hydrogenaudio.org/forums/index.php?showtopic=44310
    Code:
      Bitrate          Quality
      ~16                0.05 <<< bad
      ~33                0.15
      ~66                0.25
      ~100              0.35 <<< good (my setting)
      ~146              0.45
      ~192              0.55 <<< better
      ~238              0.65
      ~285              0.75
      ~332              0.85 <<< ridiculous
      ~382              0.95
     
  4. When I try this I get:
    To specify the paths for the external executables I had to give the relative paths, not absolute ones. I put a copy of each .exe in the Virtualdub folder to maintain a portable installation.

    Any tips to make it work? Thanks
     
    raffriff likes this.
  5. raffriff

    raffriff Moderator Staff Member Site Contributor

    No clue. Your ideas (use relative paths or copy the .exe's) sound good to me. Thanks for posting.
     
  6. Hi raffriff, I'm not sure if i'm on the correct thread so kindly let me know since I'm new to video editing. I'm currently doing a study and need to slightly modify a group of 20 video clips with several different filters and so I'm using Virtual Dub for this. Till now ok. Due to the various modifications I'm using the batch processing feature through 'Virtualdub Batch job list creator 0.2'

    so far so good, however after I set up the batch job I'm noticing that the duration of all the clips is changing to that of the template job and I need that each clip retains it's original length.

    Any help is appreciated.
     
  7. raffriff

    raffriff Moderator Staff Member Site Contributor

    Hi Huwa, this actually isn't the best place for your question, so I have replied to you to on a different thread: see "Rafriff's Awesome VirtualDub Tutorial," post #54.
     
  8. raffriff

    raffriff Moderator Staff Member Site Contributor

    SETUP QUICK START:
    1. Copy the code below and save as "ffmpeg-1.vdprof"
    2. Go to Options, External Encoders, Import and import the file you just saved.
    3. Open each imported encoder or muxer and browse for ffmpeg.exe on your system.
    4. If you can't find ffmpeg.exe in your program files, get it from zeranoe.com.

    ----------------------------------------------------------------
    Been trying to set up ffmpeg as an external encoder for some time, on and off, and I always ran into "anonymous pipe" type errors until now. Finally got it working, thanks to a post (see PDF link) from Budman1 at videohelp.com

    The great thing about ffmpeg is its versatility. Once you get one encoder working, the others are relatively easy. Here are three examples.
    • "mov ff x264+pcm": x264 video, PCM audio. MOV container
    • "mp4 ff mpeg4 q1+ac3": MPEG-4 ASP
    • "mov ff mjpeg+pcm": MJPEG
    Mix and match the various components as you please. If you don't want a MOV container, switch muxers - I've included ffmpeg muxers for avi and mp4 as well. The thing I like about QT/MOV as a container is that it accepts PCM audio, unlike MP4 (unless I'm wrong about that)

    Note: tested with ffmpeg version N-54036-g6c4516d (Jun 15 2013)
    Windows build from zeranoe.com

    ffmpeg-1.vdprof
    Code:
    {
    "description": "VirtualDub external encoder profile collection",
    "externalEncoders": {
      "sets": {
      "mov ff x264 r18+pcm": {
      "videoEncoder": "V ff 264 r18",
      "audioEncoder": "A ff pcm",
      "multiplexer": "M ff mov",
      "description": "mov",
      "extension": "mov",
      "processPartial": true,
      "useOutputAsTemp": false
      },
      "mp4 ff mpeg4 q1+ac3": {
      "videoEncoder": "V ff mpeg4 q1",
      "audioEncoder": "A ff ac3 192k",
      "multiplexer": "M ff mov",
      "description": "mp4",
      "extension": "mp4",
      "processPartial": true,
      "useOutputAsTemp": false
      },
      "mov ff mjpeg+pcm": {
      "videoEncoder": "V ff mjpeg q1",
      "audioEncoder": "A ff pcm",
      "multiplexer": "M ff mov",
      "description": "mov",
      "extension": "mov",
      "processPartial": true,
      "useOutputAsTemp": false
      }
      },
      "profiles": {
      "M ff mov": {
      "name": "M ff mov",
      "program": "C:\\Program Files\\ffmpeg\\bin\\ffmpeg.exe",
      "commandArguments": "-i \"%(tempvideofile)\" -i \"%(tempaudiofile)\"  -c:v copy -c:a copy -r %(fps) -f mov \"%(outputname)\"",
      "outputFilename": "%(outputname).audio",
      "type": 2,
      "inputFormat": 0,
      "checkReturnCode": true,
      "logStdout": true,
      "logStderr": true,
      "bypassCompression": false,
      "predeleteOutputFile": true
      },
      "V ff 264 r18": {
      "name": "V ff 264 r18",
      "program": "C:\\Program Files\\ffmpeg\\bin\\ffmpeg.exe",
      "commandArguments": "-f rawvideo -s %(width)x%(height) -r %(fps) -i - -vcodec libx264 -pix_fmt yuv420p -crf 18 -preset veryfast -x264opts colormatrix=bt709:vbv-maxrate=62500:vbv-bufsize=78125  \"%(tempvideofile)\"",
      "outputFilename": "video.mov",
      "type": 0,
      "inputFormat": 0,
      "checkReturnCode": true,
      "logStdout": true,
      "logStderr": true,
      "bypassCompression": false,
      "predeleteOutputFile": true
      },
      "V ff 264 r22": {
      "name": "V ff 264 r22",
      "program": "C:\\Program Files\\ffmpeg\\bin\\ffmpeg.exe",
      "commandArguments": "-f rawvideo -s %(width)x%(height) -r %(fps) -i - -vcodec libx264 -pix_fmt yuv420p -crf 22 -preset medium -x264opts colormatrix=bt709:vbv-maxrate=62500:vbv-bufsize=78125  \"%(tempvideofile)\"",
      "outputFilename": "video.mov",
      "type": 0,
      "inputFormat": 0,
      "checkReturnCode": true,
      "logStdout": true,
      "logStderr": true,
      "bypassCompression": false,
      "predeleteOutputFile": true
      },
      "A ff pcm": {
      "name": "A ff pcm",
      "program": "C:\\Program Files\\ffmpeg\\bin\\ffmpeg.exe",
      "commandArguments": "-i - -vn -c:a pcm_s16le -f wav \"%(tempaudiofile)\"",
      "outputFilename": "%(outputname).wav",
      "type": 1,
      "inputFormat": 1,
      "checkReturnCode": true,
      "logStdout": true,
      "logStderr": true,
      "bypassCompression": true,
      "predeleteOutputFile": true
      },
      "V ff mpeg4 q1": {
      "name": "V ff mpeg4 q1",
      "program": "C:\\Program Files\\ffmpeg\\bin\\ffmpeg.exe",
      "commandArguments": "-f rawvideo -s %(width)x%(height) -r %(fps) -i - -c:v mpeg4 -q:v 1 -pix_fmt yuv420p  \"%(tempvideofile)\"",
      "outputFilename": "video.mp4",
      "type": 0,
      "inputFormat": 0,
      "checkReturnCode": true,
      "logStdout": true,
      "logStderr": true,
      "bypassCompression": false,
      "predeleteOutputFile": true
      },
      "M ff mp4": {
      "name": "M ff mp4",
      "program": "C:\\Program Files\\ffmpeg\\bin\\ffmpeg.exe",
      "commandArguments": "-i \"%(tempvideofile)\" -i \"%(tempaudiofile)\"  -c:v copy -c:a copy -r %(fps) -f mp4 \"%(outputname)\"",
      "outputFilename": "%(outputname).audio",
      "type": 2,
      "inputFormat": 0,
      "checkReturnCode": true,
      "logStdout": true,
      "logStderr": false,
      "bypassCompression": false,
      "predeleteOutputFile": false
      },
      "M ff avi": {
      "name": "M ff avi",
      "program": "C:\\Program Files\\ffmpeg\\bin\\ffmpeg.exe",
      "commandArguments": "-i \"%(tempvideofile)\" -i \"%(tempaudiofile)\"  -c:v copy -c:a copy -r %(fps) -f avi \"%(outputname)\"",
      "outputFilename": "%(outputname).audio",
      "type": 2,
      "inputFormat": 0,
      "checkReturnCode": true,
      "logStdout": true,
      "logStderr": true,
      "bypassCompression": false,
      "predeleteOutputFile": true
      },
      "A ff ac3 192k": {
      "name": "A ff ac3 192k",
      "program": "C:\\Program Files\\ffmpeg\\bin\\ffmpeg.exe",
      "commandArguments": "-i - -vn  -f ac3 -acodec ac3 -b:a 192k -ar 48000 -ac 2 \"%(tempaudiofile)\"",
      "outputFilename": "%(outputname).ac3",
      "type": 1,
      "inputFormat": 1,
      "checkReturnCode": true,
      "logStdout": true,
      "logStderr": true,
      "bypassCompression": true,
      "predeleteOutputFile": true
      },
      "V ff mjpeg q1": {
      "name": "V ff mjpeg q1",
      "program": "C:\\Program Files\\ffmpeg\\bin\\ffmpeg.exe",
      "commandArguments": "-f rawvideo -s %(width)x%(height) -r %(fps) -i - -c:v mjpeg -q:v 1 -pix_fmt yuv420p  \"%(tempvideofile)\"",
      "outputFilename": "%(outputname).mp4",
      "type": 0,
      "inputFormat": 0,
      "checkReturnCode": true,
      "logStdout": true,
      "logStderr": true,
      "bypassCompression": false,
      "predeleteOutputFile": true
      }
      }
    }
    }
    
    Edit - added "-r %(fps)" to FFmpeg muxers
    Edit - added quick start guide
     
    Last edited: Jul 23, 2014
  9. raffriff

    raffriff Moderator Staff Member Site Contributor

    Some professional formats for transferring from VirtualDub to Premiere, Avid etc
    • Apple Prores
    • Avid DNxHD
    Requires ffmbc (or newer versions of ffmpeg)

    Code:
    {
    "description": "VirtualDub external encoder profile collection",
    "externalEncoders": {
      "sets": {
      "mov ffmbc prores+pcm": {
        "videoEncoder": "V ffmbc prores",
        "audioEncoder": "A ff pcm 48k",
        "multiplexer": "M ff mov",
        "description": "mov",
        "extension": "mov",
        "processPartial": true,
        "useOutputAsTemp": false
      },
      "mov ffmbc dnxhd+pcm": {
        "videoEncoder": "V ffmbc dnxhd",
        "audioEncoder": "A ff pcm 48k",
        "multiplexer": "M ff mov",
        "description": "mov",
        "extension": "mov",
        "processPartial": true,
        "useOutputAsTemp": false
      }
      },
      "profiles": {
      "M ff mov": {
          "name": "M ff mov",
          "program": "C:\\Program Files\\ffmpeg\\bin\\ffmpeg.exe",
          "commandArguments": "-i \"%(tempvideofile)\" -i \"%(tempaudiofile)\"  -vcodec copy -acodec copy -f mov \"%(outputname)\"",
          "outputFilename": "%(outputname).audio",
          "type": 2,
          "inputFormat": 0,
          "checkReturnCode": true,
          "logStdout": true,
          "logStderr": true,
          "bypassCompression": false,
          "predeleteOutputFile": true
      },
      "A ff pcm 48k": {
        "name": "A ff pcm 48k",
        "program": "C:\\Program Files\\ffmpeg\\bin\\ffmpeg.exe",
        "commandArguments": "-i - -vn -c:a pcm_s16le -ar 48000 -f wav \"%(tempaudiofile)\"",
        "outputFilename": "%(outputname).wav",
        "type": 1,
        "inputFormat": 1,
        "checkReturnCode": true,
        "logStdout": true,
        "logStderr": true,
        "bypassCompression": true,
        "predeleteOutputFile": true
      },
      "V ffmbc prores": {
        "name": "V ffmbc prores",
        "program": "C:\\Program Files\\ffmpeg\\bin\\ffmbc.exe",
        "commandArguments": "-f rawvideo -s %(width)x%(height) -r %(fps) -i -  -pix_fmt yuv422p -vcodec prores -qscale 1 \"%(tempvideofile)\"",
        "outputFilename": "%(outputname).mov",
        "type": 0,
        "inputFormat": 0,
        "checkReturnCode": true,
        "logStdout": true,
        "logStderr": true,
        "bypassCompression": false,
        "predeleteOutputFile": true
      },
      "V ffmbc dnxhd": {
        "name": "V ffmbc dnxhd",
        "program": "C:\\Program Files\\ffmpeg\\bin\\ffmbc.exe",
        "commandArguments": "-f rawvideo -s %(width)x%(height) -r %(fps) -i - -pix_fmt yuv422p -vcodec dnxhd -b 185M \"%(tempvideofile)\"",
        "outputFilename": "%(outputname).mov",
        "type": 0,
        "inputFormat": 0,
        "checkReturnCode": true,
        "logStdout": true,
        "logStderr": true,
        "bypassCompression": false,
        "predeleteOutputFile": true
      }
      }
    }
    }
    
     
    Last edited: Feb 10, 2014
    Takoj likes this.
  10. It's step 4.

    Why would it have an .mp4 extension when it's a Fraps file? They end in .avi. I thought the whole point was to combine the files and transcode them from the proprietary hybrid codec into h264 and mp4 (in addition to adding filters and gaining multitrack muxing in batch operations).
     
  11. raffriff

    raffriff Moderator Staff Member Site Contributor

    I copy the default file name from the AVI 'Save As' dialog and paste it into the External 'Save As' dialog so I don't have to type it. After pasting I change .avi to .mp4 - sorry that wasn't clear.

    So say my source is "Dwm 2013-06-15 22-36-49-87.avi" and I want to save the compressed MP4 as "Dwm 2013-06-13 22-36-49-87 -edit1.mp4" - copying and pasting the base file name saves a lot of time. Maybe most people would just type a more descriptive name like "series 1 ep 5.mp4", but usually I want to be able to find the original source.

    Am I understanding your question?
     
  12. The same message is showing up as it did with Alexanderxtc after hitting File > Export > Using External Encoder > Ok > type or copy whatever random name with a .mp4 extension:
    "CLI: Unable to launch video encoder: the system could not find file specified."
    I have all of the file locations set to non relative paths:
    C:\Program Files (x86)\Nero AAC\win32\neroAacEnc.exe (I'm using v1.5.4).
    C:\Program Files (x86)\GPAC\MP4Box.exe (v0.5.0)
    C:\Program Files (x86)\VirtualDub\1.10.3\x264.exe (v0.129.2245.0, product version 0.129.2245 bc13772)

    I have not altered the vdprof text from the OP beyond changing the names of the locations for the different encoders, and haven't tried going through the whole thing for using ffmpeg instead. I've also tried it with relative paths.

    I'm using VDub 1.10.3, Fraps v3.5.99.

    The path might be incorrect for the encoder:
    External Encoder Profile > Encoder > C:\Program Files (x86)\VirtualDub\1.10.3\C:program Files (x86)GPACMP4Box.exe
    The backslashes stop after the second entry for Program Files (x86), but then again I have no idea why there are two file paths in the same command line to begin with.

    There is only one avi file I'm trying to encode, not multiple split 4GB files. I suspect that the "file specified" is the input file.
     
  13. raffriff

    raffriff Moderator Staff Member Site Contributor

    > The backslashes stop after the second entry for Program Files (x86)...
    When you change program paths in the .vdprof file, remember to make all backslashes (\) doubled (\\).

    It might be easier to just import the .vdprof, then update the program paths within the GUI:
    1. Options menu, External encoders, Encoders tab
    2. Click on each item in the list and browse to the proper program location.
    3. Hit OK, repeat...

    EDIT - OP is updated to clarify this. Thanks for your questions.
     
  14. After following the OP revised instructions, I was able to transcode the original Fraps avi. I'm not sure if it was because of the change to the way relative links to the encoders are referenced, or if it was because I took out all hyphens from the file name.
     
    raffriff likes this.
  15. raffriff

    raffriff Moderator Staff Member Site Contributor

    I have done some preliminary work on making the VirtualDub encoder log output more helpful in case of error. If you get weird errors with MP4Box or NeroAAC, you might want to try this.
     
  16. I found your vdprof for Pro-res HQ very helpful.

    My question: is it possible to use the external encoder with the batch wizard?
     
  17. raffriff

    raffriff Moderator Staff Member Site Contributor

    Thank you, Eugene. It appears the batch wizard does not currently work with external encoders. You can manually add files to the Job List though - File, Queue batch operation, Export with external encoder.
     
  18. Do you know of any alternative easy-to-implement workflows that allow for batch encoding AVISynth scripts with FFMPEG?
     
  19. raffriff

    raffriff Moderator Staff Member Site Contributor

    No, I don't.
     
  20. not sure if this is the best place to post this, but i've had this annoying problem with vdub. i try to export an avi file using these external encoders, but before anything happens, i get an error.

    The audio encoding process has prematurely exited with an error code of 1 (00000001). Check the log for possible error messages.

    full log:

    [*] AVI: Opening file "E:\Fraps\Movies\2013-12-06 03-50-40-54.avi"

    AVI: OpenDML hierarchical index detected on stream 0.

    AVI: OpenDML hierarchical index detected on stream 1.

    [*] Beginning dub operation.

    Dub: Input (decompression) format is: RGB888.

    Dub: Output (compression) format is: YUV420.

    AudioEnc: ERROR: could not open AAC encoder

    AudioEnc: *************************************************************

    AudioEnc: * *

    AudioEnc: * Nero AAC Encoder *

    AudioEnc: * Copyright 2009 Nero AG *

    AudioEnc: * All Rights Reserved Worldwide *

    AudioEnc: * *

    AudioEnc: * Package build date: Feb 18 2010 *

    AudioEnc: * Package version: 1.5.4.0 *

    AudioEnc: * *

    AudioEnc: * See -help for a complete list of available parameters. *

    AudioEnc: * *

    AudioEnc: *************************************************************

    VideoEnc: raw [info]: 800x600p 0:0 @ 60/1 fps (cfr)

    VideoEnc: x264 [info]: using cpu capabilities: MMX2 SSE2Fast FastShuffle
    SSEMisalign LZCNT

    VideoEnc: x264 [info]: profile High, level 3.2

    VideoEnc:

    Mux: Cannot find H264 start code

    Mux: Error importing D:\My Documents\ghfhfh.mp4.264: BitStream Not
    Compliant

    [E] Error: The audio encoding process has prematurely exited with an error
    code of 1 (00000001). Check the log for possible error messages.



    not sure why this is happening.
     

Share This Page