ffmpeg重采样命令_在命令行上制作专辑采样器视频

ffmpeg重采样命令

ffmpeg重采样命令

Here's a video I made to raise awareness about Anaconda Limousine's first album (where I play guitar and co-wrote 1 song): https://www.youtube.com/watch?v=0LavyKbSuvI. This is a post that explains how it was made so if anyone wants to made a similar one, they can have something to step on.

这是我制作的一段视频,旨在提高人们对Anaconda Limousine的第一张专辑的认识(我在其中弹吉他并共同创作了1首歌曲): https : //www.youtube.com/watch?v=0LavyKbSuvI 。 这篇文章解释了它是如何制作的,因此,如果有人想制作一个类似的作品,他们可以有所作为。

Turns out videos like this are called "album sampler" and there are quite a few of those

原来像这样的视频被称为“专辑采样器”,其中有很多

输入和目标(Input and goals)

You start with:

您从开始:

  1. an image, the album cover

    图片,专辑封面
  2. all the songs, say in WAV format

    所有歌曲,以WAV格式说

The goal is to create a video that has the image as a background and also the title of each song. The audio for the video is 1 minute of each song starting somewhere from the middle. When you click each title, the video jumps forward to the part of the video that has this song as a background. The last step must be done manually in youtube using the annotation feature but all the rest is command-line.

目标是创建一个以图像为背景以及每首歌曲的标题的视频。 视频音频是每首歌曲从中间开始的1分钟。 当您单击每个标题时,视频会跳到以这首歌为背景的视频部分。 最后一步必须在YouTube中使用注释功能手动完成,而其余所有操作都是命令行。

Here's what the end result should look like (annotations not working in Firefox)

最终结果如下所示(注释在Firefox中不起作用)

演示地址

先决条件(Prerequisites)

I'm assuming an out-of-the-box Mac. You're on your own on other OSs.

我假设使用现成的Mac。 您可以独自使用其他操作系统。

You will need:

你会需要:

  1. Homebrew (to install the other pre-requisites)

    自制软件(安装其他先决条件)

  2. ImageMagick (for some light image manipulation)

    ImageMagick(用于某些轻型图像操作)
  3. Sox (cutting pieces of songs and fade in/out)

    Sox(剪切歌曲并淡入/淡出)
  4. ffmpeg (to make the video)

    ffmpeg(制作视频)

Installing 'brew:

安装'brew:

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

ImageMagick (install and test):

ImageMagick(安装和测试):

$ brew install imagemagick

$ convert -version
Version: ImageMagick 6.9.0-10 Q16 x86_64 2015-03-08 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC

Sox:

$ brew install sox

$ sox -h

ffmpeg:

ffmpeg:

$ brew install ffmpeg

$ ffmpeg -version
ffmpeg version 2.6.1 Copyright (c) 2000-2015 the FFmpeg developers

图片 (The image)

Starting with a cover image, scanned from the CD if you don't have the original, The CDs are pretty square:

从封面图像开始,如果没有原始图像,则从CD扫描,CD非常方形:

anaconda

Let's use imagemagick to make it more video-dimensions friendly, meaning 16:9 ratio. My image happened to be 1200px, so keeping the height 1200px and the width becomes 1200 * 16 / 9 = 2133

让我们使用imagemagick使它更适合视频尺寸,即16:9比例。 我的图片碰巧是1200px,所以保持高度1200px,宽度变成1200 * 16 / 9 = 2133 16/9 1200 * 16 / 9 = 2133

We'll have the CD cover still in the center and fill the rest of the image with blackness:

我们将CD盖盖放在中间,并用黑色填充图像的其余部分:

# 1200x1200 to 16:9 ratio with black background
$ convert anaconda.jpg -background black -gravity center -extent 2133x1200 anaconda2.jpg

Result:

结果:

anaconda-16_9

After some manual typing of the track names (in Preview app) we get:

在手动输入曲目名称(在“预览”应用程序中)后,我们得到:

anaconda2

Not the prettiest, but it will have to do.

不是最漂亮的,但必须这样做。

音讯 (Audio)

Say I have all the 9 wav files, ripped from the CD, in a ./wav directory. I need a loop that takes each file in this directory and runs it through Sox. In the past I've used ffmpeg to cut pieces of audio files, but turns out Sox can do it too and the best part is - it can also fade in and fade out so the previews are not abruptly cut.

说我从CD翻录了所有9个wav文件,它们位于./wav目录中。 我需要一个循环,使该目录中的每个文件都通过Sox运行。 过去,我使用ffmpeg剪切音频文件,但事实证明Sox也可以这样做,而最好的部分是-它也可以淡入和淡出,因此预览不会被突然剪切。

Here's the loop:

这是循环:

$ i = 1; for f in wav/*; do sox "$f" "out/$((i++)).wav" trim 0:30.0 60 fade h 0:3 0 0:4; done

Now in ./out directory I have files 1.wav, 2.wav and so on... Each of these is a 1-minute slice, starting from the 30th second of the song. It fades in for 3 seconds and starts to fade out 4 seconds before the end of the one-minute piece.

现在在./out目录中,我有文件1.wav,2.wav等...每个文件都是1分钟的片,从歌曲的30秒开始。 一分钟片段结束前,它会淡入3秒钟,然后逐渐淡出4秒钟。

Last audio step: make one file that is a concatenation of all 9 pieces:

最后一个音频步骤:制作一个文件,将所有9个部分串联在一起:

$ sox out/1.wav out/2.wav out/3.wav out/4.wav out/5.wav out/6.wav out/7.wav out/8.wav out/9.wav all.wav

视频 (Video)

The last step before uploading to youtube is to take the static image (anaconda2.jpg) and the background audio (all.wav) and make a video with ffmpeg:

上传到youtube之前的最后一步是获取静态图片( anaconda2.jpg )和背景音频( all.wav )并使用ffmpeg制作视频:

$ ffmpeg -loop 1 -i anaconda2.jpg -i all.wav -r 1 -shortest anaconda.avi

That's all folks - the result is anaconda.avi ready for youtube and the millions of fans hungry for new music.

这就是所有的人-结果是anaconda.avi为youtube准备就绪,数百万的粉丝渴望获得新音乐。

的YouTube (YouTube)

After you upload the video, you have "Annotations" option, which doesn't work in Firefox, boo-hooo!

上传视频后,您将具有“注释”选项,该选项在Firefox中不起作用,嘘!

There are 5 ways to annotate, the one I liked the most is called "Spotlight".

有5种注释方式,我最喜欢的一种称为“ Spotlight”。

Annotations can show up and then disapear, but you don't want that, so you make'em last throughout the video.

注释可能会显示出来然后消失,但是您不希望这样,所以您在整个视频中都将它们放在最后。

Make them transparent.

使它们透明。

Make them link to the same video (0LavyKbSuvI in my case) and have the second song (link, annotation) go to minute 1 of the video, the next one to minute 2 and so on.

使它们链接到同一视频(在我的情况下为0LavyKbSuvI ),然后将第二首歌曲(链接,注释)转到视频的第一分钟,将第二首歌曲转到第二分钟,依此类推。

A little trick many people oversee is to make the first track go to 0:01 (1 second in), as opposed to the very beginning, because clicks on that link reload the video page otherwise.

许多人监视的一个小技巧是,使第一首曲目转到0:01(1秒),而不是一开始,因为单击该链接会重新加载视频页面。

Screen Shot 2015-03-31 at 12.35.59 AM

谢谢阅读! (Thanks for reading!)

... and happy album sampling!

...和快乐的专辑采样!

Tell your friends about this post on Facebook and Twitter

FacebookTwitter上告诉您的朋友有关此帖子的信息

翻译自: https://www.phpied.com/making-an-album-sampler-video-on-the-command-line/

ffmpeg重采样命令

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值