Spoken Tutorial Technology/Dubbing a spoken tutorial using Audacity and ffmpeg/English

From Process | Spoken-Tutorial
Revision as of 17:54, 20 December 2012 by St-admin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Title of script: Audacity and ffmpeg

Author: Sakina Shaikh and Nancy Varkey

Keywords: audacity, ffmpeg, audio, video, merge

Resource files


Visual Cue
Narration
Slide 1 (Title slide) Hello friends. Welcome to this Spoken Tutorial on how to dub from one language into another in Linux OS. For this all you need is a headset with an audio input or a stand-alone microphone and speakers which can be attached to your computer.
Slide 2 (Version) Audacity® is free, open source software for recording and editing sounds. It is available for Mac OS X, Microsoft Windows, GNU/Linux, and other operating systems. You can download it free of cost from the site http://audacity.sourceforge.net/download/.
Slide 3 I am using the Ubuntu Linux 10.04 version operating system. I have already downloaded Audacity version 1.3 and installed it on my PC through the Synaptic Package Manager. For more information on how to install software in Ubuntu Linux, please refer to the spoken tutorials on Ubuntu available on this website.
Slide 4 The first and foremost thing you need to do is to listen to the original video. Then translate the script in such a way that the narration time for each sentence is of same or lesser duration than the sentence in the original script. This can be done by noting down the begin time of each sentence. If you cannot do this for every sentence, you can do this for a combination of two sentences. That is, even if there is a mismatch at the end of the first sentence, the sync should become correct after the second sentence is completed. It may also be possible to skip a few words or even sentences from the original, so long as the meaning is not changed. Please spend sufficient time on this activity.
Click on Applications - Sound&Video -Audacity Now we will open Audacity. Click on Applications, Sound&Video and choose Audacity to run it.
Point to Menu Bar and its options one-by-one


Point to VCR controls one-by-one

This will open an empty project on your screen. On the menu bar you can see various options like file , edit , view , transport, tracks and others. We will learn about some of them as we go along. Under the main menu, you will see the VCR controls - Pause, Play, Stop, Rewind, Forward and Record.
Point to Audio Tools Toolbar.

Point to the Selection Tool and the Time Shift tool

Point back to the Selection Tool

Next to this, you will find the Audio Tools toolbar.

This has the Selection Tool and the Time Shift tool which we will use in this tutorial.

By default the Selection Tool is active.

Play Scilab_Matrix_Operation_English tutorial “Welcome to this spoken tutorial on Matrix Operations using Scilab. To practice this tutorial, you need to have Scilab installed on your system. Open the scilab console window.”

Note the timing beforehand.

Lets do a dubbing now. I will play a tutorial on Scilab which is in English – matrixoperation.wmv.
Pause playback and wait in that window itself. And I need to dub this tutorial into Hindi using Audacity. I have already done its translation and noted the timings as mentioned earlier. Now I’m going to record it here.
Switch to the open Audacity window. Start narrating. For recording , click on the Record button and start the narration. (साइलैब के इस्तेमाल से मैट्रिक्स ऑपरेशन के इस ट्यूटोरियल में आप सबका स्वागत है । इस ट्यूटोरियल के अभ्यास लिए आपके सिस्टम में साइलैब का संस्थापन होना आवश्यक है ।)
Click on the STOP button. Click on the STOP button to stop the recording.
Point to the stereo track. You will notice 2 stereo tracks on the Audio Timeline where the narration can be seen. The spikes or waveforms.
Point to the label area.

Point to the 2 stereo tracks

Stereo Tracks contain a single label area to the left with two waveforms on the right. These correspond to the 2 channels of input - left channel and right channel.
Show a single audio track file. Ideally, record in one go. You will end up with a single audio track. Remember to pause for 1 second in between sentences, in this case.
Now go to the end of the timeline. Split wherever the spike is a plain line. Now split the clip into smaller clips at the beginning of each sentence. CTRL+I is the shortcut for splitting the audio tracks into smaller clips.
Point to the time. I will split the audio here.
Remain there. Slide the clip on the track to match the timing of that sentence as noted earlier. Choose the time-shift tool. Observe that the cursor is now a double headed arrow.
Slide the clip on the timeline. I will shift the clip to this time.
Point it out clearly. Remember, you have to go in the reverse direction i.e. starting from the last clip to the first. This is because unless you create space, the previous clip cannot move from its position.
Click on the stereo track.

Click on the Record button, say a HINDI sentence and click on STOP button.

To start with the narration of the next sentence, click on any one of the channels on the timeline. Now click on the Record button to start साइलैब कंसोल विंडो खोलिए Now click on Stop button to stop.
Point to the second track of narration. This second narration will come in another stereo track . Likewise you can record different narrations which will be seen on different tracks.
Click on the TimeShift Tool. Now we will see how to merge all these narrations or how to bring them onto a single track. Choose the time shift tool.
Right-click Drag-and-drop Select the audio clip by right-clicking on it and drag-and-drop it at the end of the first audio track. Similarly do so for all the clips.
Click on X in label area. We can remove an audio track by clicking on the X button in the label area. Let me remove the second audio track which is now empty.
Point to the timeline seconds. While sliding the clips on the first track, remember to match the begin time of the clips to the begin time of the corresponding sentence, as noted earlier.
Click on File and Save Project Once we have synchronised the beginning of each sentence with the corresponding time noted earlier, we can save our project. To do so, go to the file menu and click on Save Project As.
Click OK

Type filename “hindi _matrix operation”

A dialogue box will open. Click on OK. Next it will ask for a file name. I am giving this file name hindi _matrix operation.
Choose Desktop

Click on Save

Next it will ask for the location where it has to be saved. I will choose Desktop and click on Save. This will save the project as a .aup file.
Click on File and Export

Type name “scilab_hindi _matrix_operation”

Finally, export the final project to the required audio format i.e. wav, mp3 and others. To do that, go to the Menu Bar. Click on File. Choose the Export option. Click on it. It will ask for a file name. I will give the name as scilab_hindi _matrix_operation.
Click on the reqd folder.

Click on format – choose ogg format.

Also give the location where it has to be saved. Next choose the format for saving. I will click on ogg format and then click on Save.
Click on OK.

Again, click on OK.

Next you will get a box called Edit Metadata. Here you can add the artist name and other information as per your requirement. Click on Ok. Again click on Ok. This will create your final audio file.
Slide 5 ffmpeg ffmpeg is an open source audio and video converter that supports most standard codecs. It can convert from one file format into another quickly and easily. The source code for ffmpeg is available for download from http://ffmpeg.org/.
Show the web-page http://ffmpeg.org/. Click on Download – Scroll down and point to any one. Click on Download. Scroll down and choose the appropriate one.
Back to Slide 5 To learn how to install packages in Linux, please watch the spoken tutorials on Ubuntu available on this website. Once you have downloaded and installed ffmpeg, you will be able to execute simple yet powerful commands to extract video or audio components separately from a media file or merge the video and audio from 2 separate media files into one.
Switch to the terminal window Let me switch to the terminal window.
Type 'pwd' and press Enter.

Type 'ls'

Point to scilab_matrix_operation.ogv

Let me type pwd “present working directory” and press Enter. Displays my Present Working Directory. The ls command will list all the files and folders which are present in this directory. Let me change to the Desktop directory and Test. CTRL+L to clear the terminal screen. ls to list the files in this directory.
Type - ffmpeg -i compiling.wmv TEST0.ogv and press Enter

Point to the parameters as they are being explained.

Now let me type the command the command - ffmpeg -i compiling.wmv TEST0.ogv. The -i switch tells ffmpeg that the file immediately after it is the input file. compiling.wmv is the input file here. If -i option is omitted, ffmpeg overwrites that file when it tries to create the output file. ffmpeg uses the extension of the output file to determine the output format and codec to use. However, this can be overridden using command-line parameters. We will look at some of these shortly. This command is very useful to convert a video from one format into another. To execute the command press Enter. But I will skip this and proceed further.
Type ffmpeg -i functions.ogv -an -vcodec copy TEST1.ogv and press Enter

Point to the parameters as they are being explained.

Using the ffmpeg command in the Terminal window, we can separate the video component from the original spoken tutorial. To do so, type ffmpeg -i functions.ogv -an -vcodec copy TEST1.ogv. The '-an' switch automatically removes all audio from the output and keeps only the video component. TEST1.ogv is the output file. Press Enter. Now we have seperated the video component which means that the video is devoid of the original audio.
Type 'ls' and Enter. Let me open the Test folder here. Here is Test1.ogv. Let me play this file. <Play for 5-6 secs>
Type ffmpeg -i functions_hindi.ogv -vn -acodec copy TEST2.ogg

Point to the parameters as they are being explained.

Let me clear the terminal window once again. Now let us type the command - ffmpeg -i functions_hindi.ogv -vn -acodec copy TEST2.ogg. The '-vn' switch removes the video from the output and keeps only the audio component. Press Enter to execute this command. Now we have seperated the audio component which means that the output is devoid of the original video.
Type 'ls' and Enter. Let us check it. Let me open the Test directory once again. Here is TEST2.ogg. Let me play this. <Play for 5-6 secs>. OK. So let me close this. Lets go back to the terminal window. I'll clear the terminal window by pressing CTRL+L.
Type - ffmpeg -i TEST1.ogv -i TEST2.ogg -acodec libvorbis -vcodec copy FINAL.ogv and press Enter

Point to the parameters as they are being explained.

Now let us see how we can merge the audio which we saved with the video of the original tutorial. In the terminal, we will type - ffmpeg -i TEST1.ogv -i TEST2.ogg -acodec libvorbis -vcodec copy FINAL.ogv. Press Enter.
Type ls and Enter It is encoding now. Let clear the terminal. Let me open the Test directory. Here is FINAL.ogv just as we saved.
Point to the file

Play in the player.

Let me play this file now. <Play for 5-6 secs>. Simple, isn't it?
Slide 6 Now, one can also use editing packages like KdenLive, Kino, LiVES and many others to replace the existing audio of an original spoken tutorial with a dubbed audio.
Slide 7 with snapshot of GUI To make things easier for our dubbing contributors, we are in the process of creating a GUI application in Python, which executes all of the above ffmpeg commands – i.e. To Extract Audio, To Extract Video and To Merge. The application and the spoken tutorial for the same will soon be available on this website.
Slide 8 (Summary) That's all we have. Let me summarise the tutorial for you. Install Audacity once through Synaptic Package Manager. Listen to the original tutorial and mark the begin time of each sentence. Open Audacity. Start narrating with appropriate pauses between sentences. Ideally, record in one go. Split the audio into sentences. Starting from the back, slide the clips to match the noted timing. When done, save the audio stream in ogg format. Using ffmpeg commands, separate the video component from the original tutorial. Merge the dubbed audio and the seperated video component to create the dubbed tutorial.
Slide 9 (Acknowledgement) Spoken tutorial activity is the initiative of the ‘Talk to a Teacher’ project coordinated by www.spoken-tutorial.org, developed at IIT Bombay. Funding for this work has come from the National Mission on Education through ICT, launched by MHRD, Government of India. For more information, please visit http://spoken-tutorial.org/NMEICT-Intro. This brings us to the end of this tutorial. This is Sakina Shaikh and Nancy from IIT Bombay saying goodbye and thank you for watching.

Contributors and Content Editors

St-admin