VLC has some bugs affecting the transcode if the video includes sound. When I tried to transcode to H.264/AAC/MP4 using VLC, the result was a video without sound but with two (!) AVC streams inside.
There is another transcode method for .ogg files based on MEncoder and MP4Box:
Code:
mencoder file.ogg -vf harddup -ovc x264 -nosound -mc 0 -noskip -of rawvideo -o file.264
mencoder file.ogg -ovc raw -oac faac -of rawaudio -o file.aac
MP4Box file.mp4 -new -fps __ -add file.aac -add file.264