Welcome Guest ( Log In | Register )


Important

The forums will be closing permanently the weekend of March 15th. Please see the notice in the announcements forum for details.

Pages: (7) [1] 2 3 ... Last » ( Go to first unread post )
Encode With External Encoders, A quick how-to on the feature
« Next Oldest | Next Newest » Track this topic | Email this topic | Print this topic
Loadus
  Posted: May 29 2010, 03:58 AM


Advanced Member


Group: Members
Posts: 352
Member No.: 10881
Joined: 1-July 04



Here's a rundown on the "External Encoder" feature

user posted image




On the "Encoder Sets" tab, you have your possible combinations of your
elementary+multiplexing settings (I have a lot of redundant stuff here from
experimenting with various settings, so ignore):

user posted image





On the "Encoders" tab, you have your individual settings for each video,
audio and/or multiplexing format (even more redundant stuff here):

user posted image





To create a video (in this example a video that's playable in iPhone),
you'll need one videostream (h.264 compliant), one audiostream (AAC) and
you have to multiplex them together (into mp4 container).

Download your encoders (most can be found through links in doom9's forum/
download section), place them where you want (for convenience, I have them
in VirtualDub's folder).

For this example, you'll need:

- x264
- ffmpeg
- MP4Box





On the "Encoders" tab, click "Add..." and add a videostream encoder settings:

user posted image

Here's x264 video settings for iPhone (x264.exe):
CODE
--preset slower --bitrate 300 --thread-input --b-pyramid strict --vbv-maxrate 700 --cqm "jvt" --fps %(fps) --direct temporal --output "video.264" - %(width)x%(height)


Note that when using the pipe to feed the video, the encoder needs to know
your video parameters, ie. size, speed. And some encoders and/or multiplexers
are REALLY picky about filenames, so in some cases "something.audio" won't work.

Name this to something easy to find, like "x264".




Again, on the "Encoders" tab, click "Add..." and input your audio settings:

user posted image

AAC settings for iPhone (ffmpeg):
CODE
-i - -y -acodec libfaac -ab 128k -ar 48000 -ac 2 "audio.aac"


Name it to something simple, like "AAC".





And once more, on the "Encoders" tab, click "Add..." and set your multiplexer to kill
all living things:

user posted image

Multiplexer settings (MP4Box):
CODE
-add "video.264" -add "audio.aac" -fps %(fps) "%(outputname)"


MP4Box is somewhat critical on filenames, it won't accept the default naming.

Name this also to something simple, like "h264+AAC".





Now, on the "Encoder Sets" tab, click "Add..." and input your video settings:

user posted image


And you're ready to go.




On this example, resize the video to 480 x 272 and start encoding by selecting your
encoder set from the "Export..." option in the "File" menu:

user posted image


Select your set:

user posted image


The video starts to encode. If not, you haven't set something right (framesize,
speed, format, you haven't donated enough for VirtualDub etc). Check your
settings. And have the encoders write errors in the VirtualDub's log, makes life easier.




You can grab my settings from here:
http://www.loadusfx.net/virtualdub/vdub-ex-enc.vdprof

Most settings are "odd" due to experimenting, and the aspect ratios on the
iPhone sets seem weird - they've been calculated on the really strange formula
that Quicktime/iPhone uses, but they should look OK on the actual iPhone.




Tips on encoding stuff on the iPhone:

You can encode your video in an "odd" size, because iPhone will obey your AR setting
- Use 240 x 272 for 16:9 with AR of 161:81
- Use 240 x 208 for 2,35:1 with AR of 381:191
- Use 240 x 320 for 4:3 with AR of 52:30

iPhone will accept bitrates up to 1500kbps (in which case you can use the full
480 x 320 resolution)




Have fun, and tell me how it all went down. Remember, these settings will blow
up your computer and sell your children to the penguins of Antarctica, so don't
come running to me and say I didn't warn you.


Superhyper thanks to Phaeron for creating this feature.



--------------------
deviantART behance
 
       Top
stephanV
Posted: May 29 2010, 07:26 AM


Spam killer ;)


Group: Moderators
Posts: 4348
Member No.: 8917
Joined: 18-February 04



Thanks for your work. I'm going make this topic a sticky for future reference. smile.gif

--------------------
useful links:
VirtualDub, Input plugins and filters, AviSynth, AVI-Mux GUI, AC3ACM by fcchandler, VirtualDub FAQ
 
    Top
v0lt
Posted: May 29 2010, 07:27 AM


Advanced Member


Group: Members
Posts: 119
Member No.: 26125
Joined: 5-September 09



Virtualdub.exe-1.9.X-test20_command_arguments_patched.7z - link removed
user posted image
 
     Top
Gromozeka
Posted: May 29 2010, 08:47 AM


Advanced Member


Group: Members
Posts: 52
Member No.: 26717
Joined: 1-January 10



Loadus
How work your mencoder
what its build? where download?
 
     Top
Loadus
Posted: May 29 2010, 08:55 AM


Advanced Member


Group: Members
Posts: 352
Member No.: 10881
Joined: 1-July 04



QUOTE (Gromozeka @ May 29 2010, 02:47 AM)
Loadus
How work your mencoder
what its build? where download?

Haven't used mencoder yet for serious encoding. If I remember correctly, I couldn't get it to accept video from the pipe. I tested it, but it didn't work. If someone knows the correct syntax, feel free to post here.

The settings I have on the encoders are also pretty basic - if anyone knows really high quality<-->small filesize -settings, I'm interested in seeing those as well. ^^

--------------------
deviantART behance
 
       Top
Gromozeka
Posted: May 29 2010, 04:58 PM


Advanced Member


Group: Members
Posts: 52
Member No.: 26717
Joined: 1-January 10



Loadus
QUOTE
If someone knows the correct syntax, feel free to post here.

I know, but virtualdub not support yuv4mpegpipe sad.gif
If phaeron do it, then mencoder shall be work
 
     Top
phaeron
Posted: May 30 2010, 04:17 AM


Virtualdub Developer


Group: Administrator
Posts: 7773
Member No.: 61
Joined: 30-July 02



Wait, I just checked mencoder(1) and it looks like it supports -rawvideo format=yv12, which should work fine. Why is YUV4MPEG needed?
 
    Top
v0lt
Posted: May 30 2010, 04:51 AM


Advanced Member


Group: Members
Posts: 119
Member No.: 26125
Joined: 5-September 09



phaeron
QUOTE
Wait, I just checked mencoder(1) and it looks like it supports -rawvideo format=yv12, which should work fine.

it only seems so, no one has it normally does not run from a VD

QUOTE
Why is YUV4MPEG needed?

- will work Mencoder
- will work other encoders
- you can not specify the parameters of the frame at the command line (width, height, framerate)
 
     Top
DarrellS
Posted: May 30 2010, 05:35 AM


Advanced Member


Group: Members
Posts: 567
Member No.: 1061
Joined: 28-November 02



I'm able to create the video.264 file and the audio.aac file but I'm not able to mux the files together. What am I doing wrong?

EDIT: Phaeron helped me fix the problem. Seems that MP4Box.exe would not work without being in a folder with the files that it depended on so I directed the external encoder to C:\MyMP4Box GUI\Tools\MP4Box.exe and it muxed the files just fine.

I would like to know how to use Virtualdub to edit an MP4 file and save with the external encoder without re-encoding the file. I saw some parameter in Loadus link that looked like it copied files but I couldn't seem to get ffmpeg to work. I'm sure I'll probably have to do what I did with MP4Box and lead the encoder to the ffmpeg folder.
 
     Top
Gromozeka
Posted: May 30 2010, 08:25 AM


Advanced Member


Group: Members
Posts: 52
Member No.: 26717
Joined: 1-January 10



Phaeron
QUOTE
Wait, I just checked mencoder(1) and it looks like it supports -rawvideo format=yv12, which should work fine. Why is YUV4MPEG needed?

It's not truth!

this work fine
ffmpeg -i 1.avs -f yuv4mpegpipe - | mencoder - -of mpeg -o 1.mpg -mpegopts format=dvd -srate 48000 -ovc lavc -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:keyint=15:trell:mbd=2:precmp=2:subcmp=2:cmp=2:dia=-10:predia=-10:cbp:mv0:vqmin=3:vb_qfactor=1.25:vb_qoffset=0:vqcomp=0.75:dc=8:vstrict=0:vrc_maxrate=8800:vbitrate=7000:aspect=4/3

This not work
ffmpeg -i 1.avs -pix_fmt yuv420p -f rawvideo - | mencoder - -of mpeg -o 1.mpg -mpegopts format=dvd -srate 48000 -ovc lavc -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:keyint=15:trell:mbd=2:precmp=2:subcmp=2:cmp=2:dia=-10:predia=-10:cbp:mv0:vqmin=3:vb_qfactor=1.25:vb_qoffset=0:vqcomp=0.75:dc=8:vstrict=0:vrc_maxrate=8800:vbitrate=7000:aspect=4/3
CODE
Sorry, this file format is not recognized/supported

QUOTE

will work Mencoder
- will work other encoders
- you can not specify the parameters of the frame at the command line (width, height, framerate)

This is a serious reason
huh.gif
 
     Top
stephanV
Posted: May 30 2010, 12:01 PM


Spam killer ;)


Group: Moderators
Posts: 4348
Member No.: 8917
Joined: 18-February 04



QUOTE (DarrellS @ May 30 2010, 07:35 AM)
I would like to know how to use Virtualdub to edit an MP4 file and save with the external encoder without re-encoding the file.

That is not possible.

--------------------
useful links:
VirtualDub, Input plugins and filters, AviSynth, AVI-Mux GUI, AC3ACM by fcchandler, VirtualDub FAQ
 
    Top
Loadus
Posted: May 30 2010, 04:41 PM


Advanced Member


Group: Members
Posts: 352
Member No.: 10881
Joined: 1-July 04



QUOTE (DarrellS @ May 29 2010, 11:35 PM)
I would like to know how to use Virtualdub to edit an MP4 file and save with the external encoder without re-encoding the file.

In theory, you could use VirtualDub's Direct Stream Copy together with ffmpeg (-vcodec copy), but I can't really say if that will work - I don't know the format VirtualDub would use for DSC. You'd have to cut from the keyframes though.

--------------------
deviantART behance
 
       Top
DarrellS
Posted: May 30 2010, 05:27 PM


Advanced Member


Group: Members
Posts: 567
Member No.: 1061
Joined: 28-November 02



QUOTE (stephanV @ May 30 2010, 05:01 AM)
QUOTE (DarrellS @ May 30 2010, 07:35 AM)
I would like to know how to use Virtualdub to edit an MP4 file and save with the external encoder without re-encoding the file.

That is not possible.

Looks like another job for Avidemux.

I was wanting to save in an MKV container and Smart Render H264/AAC and Avidemux will do both.
 
     Top
Loadus
Posted: May 30 2010, 07:24 PM


Advanced Member


Group: Members
Posts: 352
Member No.: 10881
Joined: 1-July 04



xvid_encraw behaves strangely. Right at the middle of the encode it gets 'reset' or something. It kills the pipe and throws the statistics on the log. It happens always at the same frame, at different point in different videofiles (in a documentary clip it always happened at frame 50, in a trailer clip it happened at frame 335). No error is given, it just .. stops. Any thoughts on what's happening?

CODE

[i] VideoEnc:    43: key=0, time=     16, len=       7 | type=P, quant=  1,      len=       7
[i] VideoEnc:    44: key=0, time=     16, len=       7 | type=P, quant=  1,     len=       7
[i] VideoEnc:    45: key=0, time=     16, len=       7 | type=P, quant=  1,     len=       7
[i] VideoEnc:    46: key=0, time=     15, len=       7 | type=P, quant=  1,     len=       7
[i] VideoEnc:    47: key=0, time=     31, len=       7 | type=P, quant=  1,     len=       7
[i] VideoEnc:    48: key=0, time=     31, len=       7 | type=P, quant=  1,     len=       7
[i] VideoEnc:    49: key=0, time=     32, len=       7 | type=P, quant=  1,     len=       7
[i] VideoEnc:    50: key=2, time=     16, len=   22492 | type=I, quant=  1,     len=   22492
[i] VideoEnc: Tot: enctime(ms) =1111.00,               length(bytes) =   67812
[i] VideoEnc: Avg: enctime(ms) =  21.78, fps =  45.90, length(bytes) =    1329
[i] VideoEnc: I frames:      3 frames, size =   22492/  67476, quants =  1 /     2.00 /  4
[i] VideoEnc: N frames:     48 frames, size =       7/    336
[i] VideoEnc: xvidcore build version: xvid-1.3.0-dev
[i] VideoEnc: Bitstream version: 1.3.-127
[i] VideoEnc: Detected CPU flags: ASM MMX MMXEXT SSE SSE2 SSE3 SSE41 TSC
[i] VideoEnc: Detected 4 cpus, using 4 threads.



EDIT:
Looking at the encoding process, it seems like it doesn't like the audio encoder doing it's stuff at the same time .. is it possible to make the encoders work in serial, instead of parallel? First video, then audio, then multiplex. Or even in a singular mode, when you would only output video or audio?

--------------------
deviantART behance
 
       Top
phaeron
Posted: Jun 1 2010, 12:11 AM


Virtualdub Developer


Group: Administrator
Posts: 7773
Member No.: 61
Joined: 30-July 02



Serial mode would be difficult to implement, the way things are set up now.

QUOTE

QUOTE

Wait, I just checked mencoder(1) and it looks like it supports -rawvideo format=yv12, which should work fine. Why is YUV4MPEG needed?


It's not truth!

this work fine
ffmpeg -i 1.avs -f yuv4mpegpipe - | mencoder - -of mpeg -o 1.mpg -mpegopts format=dvd -srate 48000 -ovc lavc -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:keyint=15:trell:mbd=2:precmp=2:subcmp=2:cmp=2:dia=-10:predia=-10:cbp:mv0:vqmin=3:vb_qfactor=1.25:vb_qoffset=0:vqcomp=0.75:dc=8:vstrict=0:vrc_maxrate=8800:vbitrate=7000:aspect=4/3


We were talking about mencoder. ffmpeg is not mencoder.

What I want to know is why these programs have an option that doesn't work. They have command line options that are supposed to accept raw video, so what's wrong here?


 
    Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
99 replies since May 29 2010, 03:58 AM Track this topic | Email this topic | Print this topic
Pages: (7) [1] 2 3 ... Last »
<< Back to Advanced Video Processing