====== Transcode ====== ===== Conversione di un DivX danneggiato in XviD ===== Procedura utilizzata per correggere un file DivX danneggiato. Avidemux non era in grado di aprire il file. Per cominciare con mplayer (che pare essere più bravo a decodificare file danneggiati) si è convertito in //yuv4mpeg// (vedere l'opzione ''**-vo yuv4mpeg**''). Con ''**transcode**'' si converte un file dal formato //yuv4mpeg// al formato //XviD//. Prima bisogna eseguire la prima passata (-R 1) durante la quale viene salvato il file ''**divx4.log**'': transcode -i stream.yuv -R 1 -y xvid -o /dev/null Poi si esegue la seconda passata a bitrate variabile (-R 2), video encoder bitrate 6000 and keyframes every 250 frames (-w), formato audio mp3 (-N 0x55) encoder bitrate kBits/s (-b 96). Contestualmente si effettua il deinterlacing con il filtro //smartyuv//: transcode -i stream.yuv \ -J smartyuv=highq=1:diffmode=2:cubic=1:Blend=1:chromathres=4:threshold=8:doChroma=1 \ -R 2 -w 6000,250 -y xvid \ -V \ -N 0x55 -b 96 \ -o output.avi ===== Converting from Flash Video to XviD ===== Mplayer supports a very large set of video formats, including several closed codecs from the Windows platform. Using the **[[http://www.arrakis.es/~rggi3/youtube-dl/|youtube-dl]]** script, we downloaded some clips from [[http://www.youtube.com/|YouTube]], which are in the Flash Video format. The first, very simple recipe uses **''mencoder(1)''** to convert a **Macromedia Flash Video** to **XviD/MP3 AVI** in a single pass, with fixed bitrate (360 kbit/s in this example): mencoder file.flv -oac copy -ovc xvid -xvidencopts bitrate=360 -of avi -o file.avi The output audio codec is ''**copy**'' because flv should be already in mp3 format, otherwise we can specify something like **''%%-oac mp3lame -lameopts br=96:cbr%%''**. An insanely complicated recipe will use **mplayer to extract** the video and audio streams, then use **transcode to convert** the video to XviD (two pass, 400 kbit): FILE=youtube_clip mplayer -ao pcm:file=$FILE.wav -vo yuv4mpeg:file=$FILE.yuv $FILE.flv transcode -i $FILE.yuv -R 1 -w 400 -y xvid -o /dev/null transcode -i $FILE.yuv -R 2 -w 400 -y xvid -o $FILE.xvid rm $FILE.yuv divx4.log Finally we used **avidemux** to convert audio to mp3 and to mux audio and video into an avi file. FIXME How to use transcode for this final step? ===== Estrarre audio nellymoser da un Flash Video ===== Un video .flv con audio in formato //nellymoser// si ascolta correttamente con mpalyer, ma l'audio estratto con **''mplayer -dumpaudio''** oppure con **''avidemux''** non viene riconosciuto ed è impossibile ascoltarlo. Per fortuna **''ffmpeg''** è in grado di effettuare l'estrazione e la conversione automaticamente: ffmpeg -i video.flv output_audio.wav ===== How to extract subtitles from a DVD-Video into VobSub format ===== See this paragraph: **[[ripping_dvds_with_mencoder#subtitles|Ripping DVDs with mencoder - Subtitles]]**. ===== avisync ===== This is a tool that allow to adjust audio/video syncronization witout re-encode audio and video streams, you must specify time shift in frames. If count is positive, audio starts with audio frame count at the beginning of the AVI-file. If count is negative, audio is prepended count padding frames. avisync -i input.avi -o output.avi -n -10 ===== Converting AC3 audio to WAV ===== AC3 audio (aka Dolby Digital) is a **lossy** compression algorithm, so converting from and to this format **always introduces some more loss**. Neverthless I had to edit a DVD audio track with Audacity, so I need to convert it from AC3 into something that Audacity can open. The ac3 audio track was extracted with **[[mplayer|mplayer]]** and the **-dumpaudio** option. transcode -i title1.ac3 -y null,wav -o title1.wav