User Tools

Site Tools


doc:appunti:linux:video:transcode

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
doc:appunti:linux:video:transcode [2006/12/27 10:21] – external edit 127.0.0.1doc:appunti:linux:video:transcode [2017/10/12 09:19] (current) – [avisync] niccolo
Line 7: Line 7:
 Per cominciare con mplayer (che pare essere più bravo a decodificare file danneggiati) si è convertito in //yuv4mpeg// (vedere l'opzione ''**-vo yuv4mpeg**''). 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//. Contestualmente si effettua il deinterlacing con il filtro //smartyuv//. Prima bisogna eseguire la prima passata (-R 1) durante la quale viene salvato il file ''**divx4.log**'', soi si esegue la seconda passata a bitrate variabile (-R 2), video encoder bitrate: 900 (-w), formato audio mp3 (-N 0x55) encoder bitrate kBits/s (-b 96).+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**''
 + 
 +<code> 
 +transcode -i stream.yuv -R 1 -y xvid -o /dev/null 
 +</code> 
 + 
 +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//:
  
 <code> <code>
 transcode -i stream.yuv \ transcode -i stream.yuv \
     -J smartyuv=highq=1:diffmode=2:cubic=1:Blend=1:chromathres=4:threshold=8:doChroma=1 \     -J smartyuv=highq=1:diffmode=2:cubic=1:Blend=1:chromathres=4:threshold=8:doChroma=1 \
-    -R 2 +    -R 2 -w 6000,250 -y xvid \
-    -w 900 \ +
-    -y xvid \+
     -V \     -V \
     -N 0x55 -b 96 \     -N 0x55 -b 96 \
Line 24: Line 28:
 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. 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.
  
-We used **mplayer to extract** the video and audio streams, then we used **transcode to convert** the video to XviD (two pass, 400 kbit):+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): 
 + 
 +<code bash> 
 +mencoder file.flv -oac copy -ovc xvid -xvidencopts bitrate=360 -of avi -o file.avi 
 +</code> 
 + 
 +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):
  
 <code> <code>
Line 36: Line 48:
 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? 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?
  
-===== How to extract subtitles from a DVD-Video into VobSub format =====+===== Estrarre audio nellymoser da un Flash Video =====
  
-**This seems to be the best method** to extract subtitles from a DVD-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 ascoltarloPer fortuna **''ffmpeg''** è in grado di effettuare l'estrazione e la conversione automaticamente:
- +
-The same operation can be accomplished with [[mplayer#how_to_extract_subtitles_from_a_dvd-video_into_vobsub_format|mencoder]], but mencoder seems to produce different image data into the ''**.sub**'' file and slightly different timestamps into the index (''**.idx**'') file depending on the used video codec (''-ovc'' option): strange enough, I got different outputs using //copy// and //raw// options. Transcode instead seems to be more deterministic. +
- +
-[[glossary#vobsub|VobSub]] is a well known subtitle format that saves subtitles nearly in the same format as it appears in DVD subtitle streams. From a technical point of view, VobSub saves subtitles as little images. +
- +
-We can use ''mplayer'' to identify subtitle streams contained into the DVD, they are identified by an ID and a language:+
  
 <code> <code>
-mplayer -dvd-device $RIPDIR dvd://$TITLE -identify +ffmpeg -i video.flv output_audio.wav
-... +
-ID_SUBTITLE_ID=0 +
-ID_SID_0_LANG=it +
-ID_SUBTITLE_ID=1 +
-ID_SID_1_LANG=en +
-ID_SUBTITLE_ID=2 +
-ID_SID_2_LANG=it +
-...+
 </code> </code>
  
-In the following example you will extract subtitles from a DVD-Video using the ''transcode'' tools and the ''[[subtitleripper]]'' scripts. The subtitles will be saved into the [[glossary#vobsub|VobSub]] format. Two files will be generated: ''**vobsubs-en.idx**'' and ''**vobsubs-en.sub**''. In the example 0x21 is 0x20 + the subtitle ID: +===== How to extract subtitles from a DVD-Video into VobSub format =====
- +
-<code> +
-tccat -i $RIPDIR -T $TITLE -L | tcextract -x ps1 -t vob -a 0x21 > subs-en +
-subtitle2vobsub -o vobsubs-en -i $RIPDIR/VIDEO_TS/VTS_01_0.IFO < subs-en +
-</code> +
- +
-The ''**tccat**'' command will concatenate all the files that compose the specified ''$TITLE'' to the standard output. Files are taken from the directory where the DVD-Video was ripped (''$RIPDIR''). +
- +
-The ''**tcextract**'' command extract the requested stream; //ps1// stands for MPEG private stream (subtitles), the source type (''-t vob'') must be specified when reading from standard input, the required track (''-a 0x21'') must also be specified.+
  
-With [[subtitleripper]] you can convert VobSub subtitles into single .pgm images.+See this paragraph: **[[ripping_dvds_with_mencoder#subtitles|Ripping DVDs with mencoder - Subtitles]]**.
  
 ===== avisync ===== ===== avisync =====
doc/appunti/linux/video/transcode.1167211296.txt.gz · Last modified: 2009/03/14 13:16 (external edit)