Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Nächste Überarbeitung
Vorhergehende Überarbeitung
ffmpeg:map [2008/11/27 12:12] – angelegt geraldffmpeg:map [2024/02/29 13:36] (aktuell) – Externe Bearbeitung 127.0.0.1
Zeile 36: Zeile 36:
    
 Hoff es hilft Dir weiter. Hoff es hilft Dir weiter.
 +
 +----
 +Um z.B. den 2. (deutschen) Audiostream aus einem mpeg2 zu nehmen (0. Stream ist der Videostream) und ein mp4 draus zu machen:
 +<code>
 +ffmpeg -i Fellinis\ Casanova\[remux\].m2p -vcodec mpeg4 -b 1400kb -acodec mp3 -ab 112kb -ar 44100 -map 0:0 -map 0:2 Fellinis\ Casanova2.mp4
 +
 +</code>
 +----
 +
 +
 +====== FFMPEG AUDIO ======
 +
 +Quelle((http://howto-pages.org/ffmpeg/))
    
 +===== MAPPING CHANNELS =====
 + 
 + Coming back to the .vob file ripped from a DVD with tccat, it's commonplace for such multimedia files to have multiple audio streams embedded in them. Indeed, the DVD standard provides for up to 8 audio streams. Unless instructed otherwise, ffmpeg will operate on the first available sound track. 
 +
 +It so happens that I have such a .vob file on-disk, so let's see what ffmpeg thinks of it: 
 +<code>
 +$ ffmpeg -i mr.vob
 +FFmpeg version SVN-r9607, Copyright (c) 2000-2007 Fabrice Bellard, et al.
 +{snipped}
 +Seems that stream 0 comes from film source: 25.00 (25025/1001) -> 25.00 (25/1)
 +Input #0, mpeg, from 'mr.vob':
 +  Duration: 00:03:16.2, start: 620.890956, bitrate: 7704 kb/s
 +  Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 720x576, 6799 kb/s, 25.00 fps(r)
 +  Stream #0.1[0x89]: Audio: dts, 48000 Hz, stereo, 768 kb/s
 +  Stream #0.2[0x80]: Audio: ac3, 48000 Hz, 5:1, 384 kb/s
 +  Stream #0.3[0x83]: Audio: ac3, 48000 Hz, stereo, 96 kb/s
 +  Stream #0.4[0x82]: Audio: ac3, 48000 Hz, stereo, 96 kb/s
 +  Stream #0.5[0x84]: Audio: ac3, 48000 Hz, stereo, 192 kb/s
 +  Stream #0.6[0x2d]: Subtitle: dvdsub
 +  Stream #0.7[0x2c]: Subtitle: dvdsub
 +  Stream #0.8[0x2b]: Subtitle: dvdsub
 +  Stream #0.9[0x2a]: Subtitle: dvdsub
 +  Stream #0.10[0x29]: Subtitle: dvdsub
 +  Stream #0.11[0x28]: Subtitle: dvdsub
 +  Stream #0.12[0x27]: Subtitle: dvdsub
 +  Stream #0.13[0x26]: Subtitle: dvdsub
 +  Stream #0.14[0x25]: Subtitle: dvdsub
 +  Stream #0.15[0x24]: Subtitle: dvdsub
 +  Stream #0.16[0x23]: Subtitle: dvdsub
 +  Stream #0.17[0x22]: Subtitle: dvdsub
 +  Stream #0.18[0x21]: Subtitle: dvdsub
 +  Stream #0.19[0x20]: Subtitle: dvdsub
 +</code>
 +
 +The first stream, #0.0, is the video stream. Stream #0.1 is the DTS-encoded sound track and #0.2 is its AC3-encoded Dolby 5:1 equivalent. Stereo audio streams #0.3 through #0.5 are soundtracks with commentaries. Say I want to create a mono MP3 from this with the commentary from the third audio stream, #0.3. If I don't tell ffmpeg which one to use, it'll go ahead and transcode the first one it finds, the DTS stream in this case. I don't want that. This is where the "-map" option comes in handy: 
 +<code>
 +$ ffmpeg -i mr.vob -map 0:3 -vn -acodec mp3 -ar 22050 -ab 96k -ac 1 mr.mp3
 +</code>
 +"-map input:stream" tells ffmpeg to process the given stream. As we'll see later on, ffmpeg can process input from several files. "input" is the zero-based index of the input file we want to use − 0 for the first, 1 for the second etc. "stream" is the number of the stream within this file that we want to use, also zero-based. "-map 0:3" therefore means that we want to use the fourth stream in the first (and only, in this case) input file. 
 +
 +"-map" can also be used to create a new movie from this .vob file using, for example stream #0.0 for the video and #0.5 for the audio. If any streams in a video file are mapped with "-map" then they must all be specified explicitly. In this case the first "-map" option specifies the stream to use for the video and the second one specifies which stream to use for the audio: 
 +<code>
 +$ ffmpeg -i mr.vob -map 0:0 -map 0:5 -vcodec mpeg4 -b 1000k \
 +-s 640x360 -acodec mp3 -ar 22050 -ab 64k -ac 1 -f avi mr.avi
 +</code>
 + 
 +===== MULTIPLE SOURCES =====
 + 
 +
 +One of the pieces of equipment adorning my video rig here at home is a DVD recorder. Almost invariably, I record direct onto a DVD+RW so that I can take the program I'm recording apart, rework the audio track (boost the volume level among other things), put it back together again, archive the modified program onto a DVD±R and put the DVD+RW back into circulation for the next recording. 
 +
 +Once the audio track has been extracted and reworked, I can reassemble the movie in either of two manners: 
 +
 +Also extract the mpeg2video data from the .vob file and then multiplex it and the reworked audio (duly converted to MP2 or AC3) with mplex, or
 +Ask ffmpeg to pull the video in from the original .vob file and the audio from the reworked .wav audio file and transcode it on-the-fly.
 + Solution 1 is already the object of another howto page (which needs finishing now that I think of it). This is how we use solution 2: 
 +<code>
 +$ ffmpeg -i oldmovie.vob -i altered_audio.wav -map 0:0 -map 1:0 -target ntsc-dvd \
 +-b required_video_bit_rate -aspect 16:9 newmovie.mpg
 +</code>
 + Or, if you'd rather use MP2 audio and a lower audio bit rate:
 +<code> 
 +$ ffmpeg -i oldmovie.vob -i altered_audio.wav -map 0:0 -map 1:0 -target ntsc-dvd \
 +-b required_video_bit_rate -acodec mp2 -ab audio_bit_rate -aspect 16:9 newmovie.mpg
 +</code>
  
 +Obviously replace "16:9" with "4:3" if you're reworking a 4:3 aspect ratio movie. Also, this assumes that the first stream in the .vob file is the video stream, so you'll need to adjust the "-map 0:0" accordingly if, for example the video stream is the second stream as is the case with my DVD recorder, in which case you'll need "-map 0:1" instead. Either way round, this is the stream that'll be used for the video in the output file. The audio stream is mapped to "-map 1:0"
 +The "1" means "second file" (remember, the list is zero-based) and the ":0" means "first stream"
 
Nach oben
ffmpeg/map.1227787968.txt.gz · Zuletzt geändert: 2024/02/29 13:35 (Externe Bearbeitung)
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0
DFmW2CEce3htPL1uNQuHUVu4Tk6WXigFQp   Dogecoin Donations Accepted Here    DFmW2CEce3htPL1uNQuHUVu4Tk6WXigFQp  DFmW2CEce3htPL1uNQuHUVu4Tk6WXigFQp