Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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 know what the possibilities are.

Using a Linux only software is fine with me.

share|improve this question
1  
I haven't tried it, but I've heard that blender does things like that. –  Keith Sep 2 '13 at 13:26

3 Answers 3

up vote 5 down vote accepted

You can use PiTiVi.

PiTiVi will let you to flexibly adjust the volume of parallel audio tracks (among many other typical tasks: splice, rejoin, add a new soundtrack, fade the soundtrack in and out, fade the image in and out, etc).

On top of doing what you need (unless I understood it wrong) it is quite easy to use and comes with most linux distros.

screenshot of GUI

    ss of GUI

share|improve this answer
    
You understood it right. Editing in PiTiVi works great for me. But I am unable to render my project. If I set MP4,x264enc,aac, the video is just a random noise. When i select WebM,VP8,Vorbis, the video is sometimes horribly pixelated. Judging by the file size, the quality is set to be quite high, so the pixelation should not be happening. In both cases (WebM and MP4) I am using the default codec settings. –  user7610 Sep 3 '13 at 15:22
1  
I tried again a year later and now PiTiVi worked fine. Nowadays I usually switch between Kdenlive, OpenShot, Blender or Cinerella, which seem to be currently the best that is out there, review linux.com/news/software/applications/… . –  user7610 Sep 10 at 16:56

There is a pretty extensive number of applications which you could use to do this.

  1. Avidemux

    Avidemux is a free video editor designed for simple cutting, filtering and encoding tasks. It supports many file types, including AVI, DVD compatible MPEG files, MP4 and ASF, using a variety of codecs.

    ss #1

  2. Openshot

    Video Editing program OpenShots Features include: * Support for many video, audio, and image formats (based on FFmpeg) * Gnome integration (drag and drop support) * Multiple tracks *, etc.

    ss #2

  3. Kdenlive

    Kdenlive is a free and open-source video editor for GNU/Linux, FreeBSD and MacOsX.

    ss #3

  4. VideoLAN Movie Creator

    VLMC (VideoLAN Movie Creator) is a free video editing software, offering features to realize semi-professional quality movies, but with the aim to stay simple and user-friendly.

    ss #4

  5. Cinelerra

    Cinelerra is a highly advanced and professional video editing software, but still remains open source. Cinelerra solves three main tasks: capturing, editing and compositing.

    ss #5

  6. Jahshaka

    Jahshaka (formerly known as CineFX) aims to become a cross-platform, open source, free, video editing software, effects, and compositing suite. It is currently in alpha stage, supporting realtime effects, etc.

    ss #6

  7. LiVES

    LiVES is a Video Editing System. It is designed to be simple to use, yet powerful. It is small in size, yet it has many advanced features. LiVES mixes realtime video performance and non-linear editing in one window.

    ss #7

  8. Kino

    Kino is a non-linear DV editor for GNU/Linux. It allows you to record, create, edit, and play movies recorded with DV camcorders. This program uses many keyboard commands for fast navigating and editing inside.

    ss #8

  9. Lumiera

    Lumiera is NonLinear Video Editing (NLE) for GNU/Linux developed by the CinelerraCV community. It was born as a rewrite of the Cinelerra codebase called Cinelerra3 but it is now an independent project with its own repository and codebase.

    ss #9

  10. Cinecutie

    Cinecutie is a Cinelerra mockup with some experiments (like utf8 fonts antialias and more).

    ss #10

  11. Shotcut

    Shotcut is a free, open source, cross-platform video editor.

    ss #11

  12. Hybrid

    Hybrid is a multi platform (Linux/Mac OS X/Windows) Qt based frontend for a bunch of other tools which can convert nearly every input to x264/Xvid/VP8 + ac3/ogg/mp3/aac/flac inside an mp4/m2ts/mkv/webm/mov/avi, etc.

    ss #12

References

share|improve this answer

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.

share|improve this answer
    
Nice write up!! –  slm Sep 3 '13 at 18:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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