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

news/2024/7/10 20:00:15 标签: ffmpeg, 计算机视觉, anaconda, mac, https
https://img-blog.csdnimg.cn/img_convert/0ae2b55ca678de63e6a5326724a3e962.png" alt="ffmpeg重采样命令" width="403px" height="256px" style="outline: none;" />

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非常方形:

https://img-blog.csdnimg.cn/img_convert/9aae3c4757ef5e5f755dc974ceb5ea73.png" alt="anaconda" width="300" height="300" style="outline: none;" />

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:

结果:

https://img-blog.csdnimg.cn/img_convert/c147ed3aef78e602cc1fdd302b643e10.png" alt="anaconda-16_9" width="300" height="169" style="outline: none;" />

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

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

https://img-blog.csdnimg.cn/img_convert/ccd3fc2b353e3aae57669872075fec36.png" alt="anaconda2" width="300" height="169" style="outline: none;" />

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秒),而不是一开始,因为单击该链接会重新加载视频页面。

https://img-blog.csdnimg.cn/img_convert/9794f2c0a504e2f29494c5decb690f37.png" alt="Screen Shot 2015-03-31 at 12.35.59 AM" width="650" style="outline: none;" />

谢谢阅读! (Thanks for reading!)

... and happy album sampling!

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

Tell your friends about this post on Facebook and Twitter

在Facebook和Twitter上告诉您的朋友有关此帖子的信息

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

ffmpeg重采样命令


http://www.niftyadmin.cn/n/1307272.html

相关文章

ie mhtml_MHTML –需要数据时:IE7及以下版本中的URI

ie mhtmlUPDATE: Its very important to have a closing separator in the MHTML document, otherwise there are known issues in IE7 on Vista or Windows 7. The details are here. 更新:在MHTML文档中有一个分隔符非常重要,否则在Vista或Windows 7的…

100句十分精辟的人生格言

100句十分精辟的人生格言 1、生活是一面镜子。你对它笑,它就对你笑;你对它哭,它也对你哭。 2、活着一天,就是有福气,就该珍惜。当我哭泣我没有鞋子穿的时候,我发现有人却没有脚。 3、人生是个圆&#xff0c…

100句富有哲理的人生格言

100句富有哲理的人生格言 1、人之所以有一张嘴,而有两只耳朵,原因是听的要比说的多一倍。 2、哲人无忧,智者常乐。并不是因为所爱的一切他都拥有了,而是所拥有的一切他都爱。 3、泪水和汗水的化学成分相似,但前者只能为…

SSH2三大框架整合出错(一)

usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ] { -help | start | stop } 2013-12-1 22:01:15 org.apache.catalina.core.AprLifecycleListener init 信息: Loaded APR based Apache Tomcat Native library 1.1.27 using APR versi…

HTTPS迁移:Dreamhost上托管的WordPress博客

I use Dreamhost. Have been since 2008. If youre not using Dreamhost... well, go sign up and heres $50 off of the $97 yearly plan. 我使用Dreamhost。 自2008年以来一直。如果您不使用Dreamhost ...那么,快去注册吧,这是$ 97年度计划的$ 50折扣。…

SSH2三大框架整合出错(二)

usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ] { -help | start | stop } 2013-12-1 22:29:26 org.apache.catalina.core.AprLifecycleListener init 信息: Loaded APR based Apache Tomcat Native library 1.1.27 using APR versi…

智能图像处理及应用下载_智能浏览器不会下载不需要的图像

智能图像处理及应用下载We ofter complain about browsers, browser inconsistencies, quirks, hickups, the list goes on. Lets say something nice to them, and hope for good karma 🙂 我们经常抱怨浏览器,浏览器不一致,怪癖&#xff0c…

PEAR :: Structures_DataGrid列格式化程序的建议

This posting outlines a proposal for an addition to the PEAR package Structures_DataGrid. More specifically it concerns the formatter method of the Structures_DataGrid_Column class. 这篇文章概述了添加PEAR包Structures_DataGrid的建议。 更具体地说,…