function convertMainVideo($sId, $sTmpl = "", $bRecorded = false)
{
    global $sFilesPath;
    global $sModule;
    $sTempFile = $sFilesPath . $sId;
    $sResultFile = $sTempFile . (usex264() ? M4V_EXTENSION : FLV_EXTENSION);
    $bResult = true;
    if (!file_exists($sResultFile) || filesize($sResultFile) == 0) {
        if (empty($sTmpl)) {
            $sTmpl = getConverterTmpl($sTempFile, $sTempFile, true, $bRecorded);
        }
        $sTmpl = prepareCommand($sTmpl, array("output" => $sResultFile));
        $bResult = convertVideoFile($sResultFile, $sTmpl);
        if (!$bResult) {
            $sTmpl = getConverterTmpl($sTempFile, $sTempFile, false);
            $sTmpl = prepareCommand($sTmpl, array("output" => $sResultFile));
            $bResult = convertVideoFile($sResultFile, $sTmpl);
        }
    }
    if ($bResult && usex264()) {
        $bResult = moveMp4Meta($sResultFile);
    }
    return $bResult && grabImages($sResultFile, $sTempFile);
}
 function generateNewFile($sSource, $sNew)
 {
     global $sFfmpegPath;
     $sMobileCommand = getConverterTmpl($sSource, "qcif") . "-b 512000 -sameq -ab 64000 -acodec libfaac -ac 1 " . $sNew;
     popen($sMobileCommand, 'r');
 }