Step #3 - Create batch file for Flash Media Encoder (FME)
Notepad c:\justin.bat with this info:
"C:\Program Files\Adobe\Flash Media Live Encoder 3.1\FMLEcmd.exe" /p c:\justin.xml
Step #3.5 - GET INITIAL XML
Run Flash Media Encoder 3.1 (C:\Program Files\Adobe\Flash Media Live Encoder 3.1\FlashMediaLiveEncoder.exe). Select the sound capture device that you wish (Eg. Stereo Mix). Then select “Save Profile”. Then open up that file you have saved and locate the following line:
Line In (Realtek High Definitio
Note: It will have the name of the audio device you selected. Cut/paste that entire line into a new notepad document for step #4. You may now close the profile you opened up as well as the FME graphic interface.
Step #4 - Create FME XML
Notepad c:\justin.xml. Copy and paste the following :
<?xml version="1.0" encoding="UTF-16"?>
<flashmedialiveencoder_profile>
<preset>
<name>Custom</name>
<description></description>
</preset>
<capture>
<video>
<device>SCFH DSF</device>
<crossbar_input>0</crossbar_input>
<frame_rate>60.00</frame_rate>
<size>
<width>640</width>
<height>360</height>
</size>
</video>
<audio>
<device>Line In (Realtek High Definitio</device>
<crossbar_input>0</crossbar_input>
<sample_rate>22050</sample_rate>
<channels>1</channels>
<input_volume>75</input_volume>
</audio>
</capture>
<encode>
<video>
<format>H.264</format>
<datarate>1000;</datarate>
<outputsize>640x360;</outputsize>
<advanced>
<profile>Baseline</profile>
<level>3.1</level>
<keyframe_frequency>10 Seconds</keyframe_frequency>
</advanced>
<autoadjust>
<enable>false</enable>
<maxbuffersize>1</maxbuffersize>
<dropframes>
<enable>false</enable>
</dropframes>
<degradequality>
<enable>false</enable>
<minvideobitrate></minvideobitrate>
<preservepfq>false</preservepfq>
</degradequality>
</autoadjust>
</video>
<audio>
<format>MP3</format>
<datarate>48</datarate>
</audio>
</encode>
<restartinterval>
<days></days>
<hours></hours>
<minutes></minutes>
</restartinterval>
<reconnectinterval>
<attempts></attempts>
<interval></interval>
</reconnectinterval>
<output>
<rtmp>
<url>rtmp://live.justin.tv/app</url>
<backup_url></backup_url>
<stream>live_xxxxxxxx_yourID</stream>
</rtmp>
</output>
<metadata>
<entry>
<key>author</key>
<value></value>
</entry>
<entry>
<key>copyright</key>
<value></value>
</entry>
<entry>
<key>description</key>
<value></value>
</entry>
<entry>
<key>keywords</key>
<value></value>
</entry>
<entry>
<key>rating</key>
<value></value>
</entry>
<entry>
<key>title</key>
<value></value>
</entry>
</metadata>
<log>
<level>0</level>
<directory>C:\</directory>
</log>
</flashmedialiveencoder_profile>
Insert/replace the tag you’ve previously extracted from your created profile in step #3.5.
Now you need your stream ID. To get this JTV stream ID, log into JTV and then click here. Your ID should be at the bottom of the page, just copy and paste it in the corresponding tag of your justin.xml file.
Now select UNICODE in Notepad before saving this, like shown in the pic below (very important).
Step #5 - Start a blank streaming test
Simply run the justin.bat file by double-clicking it and it should pop up a black window that scrolls some stats about FPS and bitrate. Pay attention to the input fps, it should be at 60 fps (and so does the output of course) even if you’re just capturing your plain static desktop.
If it’s not at 60 fps, then maybe you need to check/reconfigure SCFH DSH by launching VLC again like in Step #2, otherwise you can close the black window.
NB : from my recent tests it looks like SCFH DSF also needs to be open BEFORE running the justin.bat file for the framerate to go as high as 60.
Step #6 - Capturing and processing the video you’re going to stream
This is the part where VirtualDub skills will be needed, mostly to compensate the mediocre video quality these USB capture keys (like the one I have) provide (great value for the price though). I’m assuming here that you have everything setup, drivers for your capturing device installed and working.
Open VirtualDub, “File”, “Capture AVI”, pick your capturing device in the “Device” menu (mine is “USB 2861 Device (DirectShow)”), you should see the output screen of your console…
Two scenarii from here : either you want to capture a live feed on-the-fly (ie. for a tourney), then follow #6.a, OR you have all the time in the world to process & improve the video you want to show everyone, then follow #6.b. Both ways eventually lead to #6.c.
#6.a - Capturing and streaming a live-feed “on-the-fly”
Open the “Video” menu, check “Preview”, pick “Progressive - both fields” under the “Previous acceleration” sub-menu right below.
Go down to the “Filter chain” sub-menu, and check “Enable”, click “Filter list…” right below and then “Add”…
#6.b - Capturing a video for postponed processing purposes
Select “Enable audio capture” in the “Audio” menu.
Hit the F6 key to start capturing your favorite match (and Escape to stop the recording).
Open the resulting AVI file with another instance of VirtualDub, click “Filters” in the “Video” menu, then “Add”…
#6.c - Adding filters to fine-tune our video
Double-click “bob doubler” in the list of filters and configure it to : “Top field first” in the field order and “Adaptive ELA” in the Deinterlacing method. Click Ok.
NB : this is the filter that doubles the framerate of your original 25 fps to 50 fps while deinterlacing.
Now you need to add a second filter : the “Resize” filter which we’ll configure in the following way (pic below) :
See how the width and height match the ones we previously configured in justin.xml ?
The key here is to avoid to let FME do the resizing job because it’s plain bad, we’d rather use the more trustworthy Lanczos algorithm from VirtualDub. Once configured close the dialog. You should now have the two filters listed like in the pic below :
Close the filters dialog by clicking “OK” (and hit F7 to save the processed video on your drive if you followed the #6.1 scenario)
Step #7 - Final preparations and live cap to Jtv
Again, two scenarii depending on which option you choosed before : pick 7.a if you choosed 6.a and 7.b if you choosed 6.b. Both ways lead to 7.c :
#7.a - Capturing the ouput of VirtualDub to Jtv
WARNING : the following doesn’t seem to work properly on Windows 7 as I described earlier and I still haven’t been able to find a true solution to this : the coordinates of my custom area selection are always ignored by the SCFH DSF driver somehow, and I’m stuck with a top left corner portion of the screen area only. You should be fine if using Windows XP though (maybe Vista too I need feedback).
Launch SCFH DSF, pick VirtualDub.exe in the “Process list”. Click on “Area Selection”, drag and resize the green selection over the window you want to capture, as shown in the above pic, double-click to apply. Click “Apply” (both buttons).
NB : A good way to check if the selection we just defined is actually properly applied is to launch VLC exactly like in Step #2 and see if the dimensions of the capture area are correct
#7.b - Playback of our processed video in VLC
Apply the same method as described in Step #7.a except that you want to create an area selection over your video player window obviously.
[WORKAROUND for the Windows 7 bug] I use VLC to playback my processed video with the following command parameters :
"C:\Program Files\VideoLAN\VLC\vlc.exe" --no-video-deco --no-embedded-video --high-priority
Write this to a .bat file if you want to launch VLC in “borderless mode” and stuck in the top left corner (yeah cheap workaround but it works).
#7.c - Go live !
Launch the justin.bat file created earlier by double-clicking it and constantly check in the “black window” that your input fps doesn’t drop AND match your output fps (like in the pic below). This really is the key to a smooth stream.
If you get fps drop your CPU is probably overloaded, in that case you may have to decrease the framerate unfortunately, OR switch to FME 2.5 (instead of 3.1 here) which is lighter on the CPU. The only reason I haven’t mentionned it so far is that I couldn’t get a solid 60 fps with it, but you may try it if 3.1 is too CPU heavy on your computer (provided you stick to something less than 60 fps).
Also keep an eye on the “Buffer” value, the higher it gets the more your bandwith is exceeded; A high value means you need to lower the <bitrate> *** in your justin.xml file (Step #4), and yes it requires quite a lot of trials and errors :wonder:
** the bitrate is the value that sets the actual video quality, the higher the better your video quality will be, but the higher the more your bandwith is likely to be exceeded, hence the need to be careful about the buffer value which tells you how much you’re exceeding it.*
Credits go to MultiBoxing for Steps #3 to #4, I ripped off a lot of your text 