0

I have a video file that has two audio tracks. The first one is background music and the other one is commentary. I want to merge those tracks together.

This is the media information I got from ffmpeg:

Input #0, avi, from '24.avi':
  Metadata:
    encoder         : BandiAviMuxer 1.0
  Duration: 00:17:49.13, start: 0.000000, bitrate: 10514 kb/s
    Stream #0:0: Video: mpeg1video (MPEG / 0x4745504D), yuv420p, 1280x1024 [SAR 1:1 DAR 5:4], 104857 kb/s, 30 tbr, 30 tbn, 30 tbc
    Stream #0:1: Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo, s16p, 192 kb/s
    Stream #0:2: Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo, s16p, 192 kb/s

I am looking for a GUI tool, because I need to be able to interactively fine tune the relative volume of the audio tracks. I may need to apply different volume ratios throughout the video. So I need some ability to edit volume as curves, with keypoints and some simple interpolations between them.

I haven't done any video editing recently so I do not have a favourite application. There is a lot of video editors. I do not want to try each application in turn and see if it supports my work flow.

Using a Linux only software is fine with me.

0

I tried doing the task in Blender and PiTiVi.

Blender

Score: 3/5

I am using this well written tutorial on the Video Sequence Editor in Blender as a reference. I actually toyed with 3D modeling in Blender before. I never realized it can be used as a video editor. I sort of know some of the Blender keyboard shortcuts, which helps.

Installation

Grab a Linux binary distribution from the project webpage, extract the archive into e.g. ~/bin and run file named blender.

Video editing

Blender cannot import a video file with multiple audio tracks. It imports only the first track. Therefore, a quick solution in ffmpeg is to copy out the audio tracks and import them separately

ffmpeg -i 24.avi -map 0:1 -c:a copy ~/fst.mp2
ffmpeg -i 24.avi -map 0:2 -c:a copy ~/snd.mp2

now I can add those audio files just fine with the procedure described in the first linked article.

Setting the volume is also described in the article, as well as adding key frames. What is not described is how to edit the curve. So the answer is to use the same selection methods as for clips. Selection with RMB, moving with pressing G key and so on. There is a Blender manual page about the so called Graph editor

Rendering

In rendering options, under the video size, I had to change the size slider to 100 % and I also turned off antialiasing, because I believe it is useless here.

There was this strange bug: Before rendering, I had to move my cursor on the first frame (frame number 1) and hit Refresh Sequencer. Otherwise the rendered video file was just completely black.

I managed to crash Blender once by frantically clicking over the timeline while rendering.

Speed

About 5 fps on default H264 + MP3 settings. Considering my video is 30 fps, it is really slow. The encoding was not using all the available CPU cores (I had left this setting on auto) The resulting video was visually pleasing ;-)

PiTiVi

Score 0/5

About two years back, I had an unpleasant experience with PiTiVi. So I was excited to check out what changed.

Installation

I use Fedora 19, so yum install pitivi executed under the root user does the job.

Next I went over the list of gstreamer plugins and considered installing everything I could get my hands on

yum install gstreamer-plugins-ugly \
gstreamer-plugins-good-extras \
gstreamer-plugins-good \
gstreamer-plugins-bad-nonfree \
gstreamer-plugins-bad-free-extras \
gstreamer-plugins-bad-free \
gstreamer-ffmpeg

some of these packages are in RPM Fusion repository. The install size was quite large, 142 MB, so I decided to try without installing them. This did not work (PiTiVi spitted out a Missing plugin errors for both audio and video in my file), so I installed all the plugins after all, just to be sure. I had to restart PiTiVi so it would notice the new plugins.

Video editing

PiTiVi has the same problem Blender has with multiple audio tracks in a video clip. It imports only the first one. The solution was the same as in the case of Blender.

ffmpeg -i 42.avi -map 0:2 -c:a copy ~/42snd.mp2

The UI is pretty simple, so adding the clips and placing it on the timeline needs no explanation. The volume curve is visible right from the timeline. Keyframes are added by double clicking RMB and can be moved around with LMB. Easy. I haven't figured out how to do interpolate them on a Bezier curve, but linear interpolation sounded fine, so I haven't investigated this further.

Rendering

First of all, the rendering dialog always froze at "1 second remaining", sometimes "2 seconds remaining". It never actually completed. Still, the output file was created.

Setting output format to mp4, video codec to x264enc and aac for audio, keeping default settings, the result was a broken video file that could not be played in VLC and when played in mplayer it had no sound and the image was a colorful mosaic of random brightly colored squares.

Choosing WebM, with VP8 and Vorbis, again keeping the default settings, the result was OK, but at approximately five occasions the whole image pixelated as if watching a low quality DVB-T broadcast. The 30 min video file is over a gigabite in size, so I assume it is not due to low quality presets.

Speed

Rendering my 30 minute long video into WP8 file with VP8 for video and Vorbis for audio took about 2 and half hours. Again, it did not make use of my multicore CPU by default. This setting is hidden in the detailed options for individual codecs.

Conclusion

Judging by usability and GUI, PiTiVi wins. It is significantly easier to work with and it has a nicer waveform visualization for sound tracks on the timeline ;-) The volume curve is visible by default and it is very easy to edit. Also, playing the preview of the final video works much better for me in PiTiVi out of the box. In Blender, the video tends to lag behind sound. The linked tutorial suggests changing cache sizes. I haven't tried that because hearing the sound was sufficient for me.

What does not work in PiTiVi is rendering. Even though it is nice to be able to easilly do my edits, it is quite useless if I cannot render it afterwards.

So there is no clear victor among the two.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.