As all music copyright holders will tell you, adding music you like (but do not own) to family video clips is copyright infringement. As such, you should remove the audio track entirely to avoid getting into a lawsuit… or worse, getting your video removed from Youtube :)
The command below is will list all streams that exist in your video file.
As you can see in the example above, my file contains two streams: the video stream (h264) as 0:0 and a single audio stream as 0:1
To get rid of the audio stream with ffmpeg, I simply needed to ask ffmpeg nicely to copy the file, keeping the 0:0 video stream, ignoring the audio stream and leaving the codecs alone (i.e., not trying to reencode anything):
In my previous post, I’ve described the little tool I’ve put together to help me out trigger my DSLR remotely & how I’ve used it to create basic time-lapse videos.
The video quality of my first attempts were pretty.. miserable. Soo I HAD TO try and find a better approach. Here’s where I am at right now and the next steps on my list to further improve the result quality.
Yesterday, I’ve taken two image sequences: one of my garden (again :p) and another one inside our living room. I’ve used a delay of 10 seconds for both but (somewhat) different settings for the shots.
I didn’t prepare much before taking these image sequences; my goal was only to have some raw material to use as input and to run some experiments with the tools currently at my disposal.
For the garden sequence, I’ve used a small — though not small enough — aperture (f 8) and a short exposition time (1/125s).
For the living room sequence, I’ve used a smaller aperture (f 11) and a longer exposition time.
Again, my goal wasn’t to have great images as input so don’t mention the images quality ;-)
I’ve gathered 384 shots for the first sequence and 165 for the second (time ran out ^^).
Here are the final videos. As you can see below, those videos are already of MUCH better quality than my first attempts.
Second sequence (fast):
Second sequence (medium):
Second sequence (slow):
Without further ado, let me describe how I went from the RAW input files (DNG) to the resulting video.
First, I had to convert my raw files to a file format that ffmpeg can work with. I’ve used XnConvert, but for CLI lovers, ImageMagick can probably do that too.
Next, I needed to rename all files to follow a very simple naming convention (you’ll see later why that’s useful). Here’s a simple one-liner to do that easily:
What this command does is that it takes all .png files in the current (or sub) folder(s) and renames them, ensuring that they all contain 4 digits. For example ‘IMGP_20150124001.png’ will become ‘0001.png’ and ‘IMGP_20150124002.png’ will become ‘0002.png’.
The last step (yep, already) is to actually create the video. In the example below, I create the video and directly add a soundtrack to it:
map the video and audio tracks (only one -map argument is needed if there is no input audio!)
you can use this option if you want to loop your images (i.e., when the encoder has gone through all input images, it starts over with the first image)
this can be useful if you want to loop until something else is done (e.g., until the end of the audio input track if you remove the ‘-shortest’ argument)
Note that the order of the arguments DOES matter!
ffmpeg is a very versatile & powerful command line utility, so this barely scratches the surface of what it can do (and I’m by no means a specialist). If you want to know more, check out the official docs.
There you have it! Quite simple heh :)
In the example above, I’ve directly added the audio track using ffmpeg, but I don’t recommend this. You’ll be much better off adding the audio track afterwards; ideally using a video editing software such as Pinnacle Studio, Adobe Premiere, Adobe After Effects and the like ;-)
With these, you’ll be able to make nice transitions, precisely mix & match the audio and video, etc.
So to conclude, this is a much better approach for generating time-lapse videos than what I did at first.. but I realize that this is still very amateurish.
I want to further improve the output video quality (not only encoding-wise), but to do so, I’ll need to:
capture more input pictures so that I can make longer videos at a higher frame rate (ideally I’d like to try and generate 60fps videos)
think a bit more about the relation between:
the total number of frames
the delay between each frame
the obturation speed
post-process the input frames at least a bit to even out the exposure, etc
this should really boost the resulting video quality
post-process the video once generated
add the audio and sync it correctly
add effects such as fade-in, fade-out, ease-in, ease-out