Note: This post has been rewritten a number of times, based on hours of testing. It is now correct.
Further updated to add transcoding of .flv files.
Sometimes it is necessary, when a video player does not have the power to decode some video streams, as is the case with the WII, to use a more powerful server to transcode the files into a lesser format and stream the result to the player.
In order to transcode and stream any video(including Hi-def AVC/AAC .mp4 files where the video resolution can be up to 1280 and the audio up to 6 channels)
to a .mpg file with lower resolution 640 Mpeg-2 video and 5.1 AC-3 audio with embedded subtitles, you can use the following command: (Remove the (x86) if you are not on a 64 bit system)
"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" -vvv %1 --sout #transcode{venc=ffmpeg,vcodec=mp2v,vb=8000,scale=.5,width=640,fps=30,acodec=a52,ab=384,channels=6
,samplerate=48000,soverlay}:std{access=http,mux=ts,dst=:8081} --sub-autodetect-fuzzy=4
Without these specific parameters VLC may dump, or refuse to encode either the video or audio.
vb=8000 gives maximum picture quality at 8mbps but may be changed. (normal DVD quality is 4000)
Note: If you are streaming over your LAN, 8000 may be too high, and you may get buffering delays..if so drop the rate to 6000 and try again.
scale=.5 is required to display the full picture
width=640 is required to maintain the original aspect ratio
fps=30 is required to use the mp2v encoder
acodec=a52 (ac-3) is required to support up to 6 channels
ab=384 gives maximum audio quality but may be changed to 128 or 256
channels=6 is the ac-3default and is optional
samplerate=48000 is the ac-3 default and is optional
soverlay is optional and will overlay any subtitles on the streamed video
http is the streaming protocol and it can be changed to whatever protocol your player will accept. (I have tested udp and mmsh)
mux=ts works with http and mmsh and apparently is required by udp
dst=:8081 is required with http to prevent a bind error and makes the stream available to any client on your lan. Udp and mmsh require dst=client-url:port
--sub-autodetect-fuzzy=4 is optional and says to detect those subtitles which match the filename exactly.
use --no-sub-autodetect-file instead if you do not want subtitles detected and overlayed.
This command works with .mpg, .mp4, divx .avi, and .mkv files but because of a VLC bug it does not work with .ts files if there is a corresponding subtitle file present. By renaming the .srt to .srtx or using --no-sub-autodetect-file , .ts files will also transcode and stream but without the embedded subtitles. If you need subs with .ts (which I do to display the subs that I have extracted from the closed captions in my HDTV ASTC .ts stream captures), your only choice interim to a VLC fix is to use WinFF and "convert to DVD" with the DVD HQ-Fullscreen or Widescreen Profile depending on the source aspect. This will give you an .mpg file which will transcode and stream with subtitles.
This command will also work with .flv files containing H.263 or VP6 video streams, but due to a bug in VLC, .flv files containing AVC video and AAC audio streams wil not transcode. The work around is to pre-transcode these files to AVC/AC-3.mp4 files using ffmpeg and then transcode and stream them with the above command. The process to do this is now built into the STREAMVIDEO.BAT file posted below. See my post below regarding why you might want to permanently pretranscode all these avc/aac.flv files to avc/ac3.mkv.
You may now test that this VLC (Server) streaming command is working by starting a VLC (client) on your PC with the command ' VLC http://localhost:8081 '. I use this "PlayStream.bat (Remove the (x86) if you are not on a 64 bit system)
=========================================
@echo off
: URL must contain @ sign
"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" http://@192.168.1.10:8081
=========================================
Note that you cannot use the "Play Network Stream" in the GUI to start playing this stream. You must issue the command. I have also noticed that the VLC client may get confused at times after playing a few streams and either not display the embedded subs or overlay successive subs. Restarting the VLC client fixes that.
Hopefully others may benefit from this info.