我试图从一组帧使用FFMPEG使用libx264编解码器编码。mp4视频。

这是我正在运行的命令:

/usr/local/bin/ffmpeg -r 24 -i frame_%05d.jpg -vcodec libx264 -y -an video.mp4

我有时会得到以下错误:

[libx264 @ 0xa3b85a0] height not divisible by 2 (520x369)

在搜索了一下之后,似乎这个问题与缩放算法有关,可以通过添加-vf参数来修复。

然而,在我的例子中,我不想做任何缩放。理想情况下,我希望保持尺寸与框架完全相同。任何建议吗?是否存在h264强制的某种纵横比?

ffmpeg -r 1/5 -start_number 2 -i img%03d.png -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4

这一行工作得很好,但我想从另一个文件夹中的图像创建一个视频文件。 我文件夹中的图像名称是:

img001.jpg
img002.jpg
img003.jpg
...

我如何从不同的文件夹输入图像文件?例如:C: \ mypics

我尝试了这个命令,但ffmpeg只生成了第一个图像(img001.jpg)的视频。

ffmpeg -r 1/5 -start_number 0 -i C:\myimages\img%03d.png -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4

我有一个关于将node_modules包含到HTML网站的最佳实践的问题。

假设我在node_modules文件夹中有Bootstrap。现在对于网站的生产版本,我将如何包括位于node_modules文件夹内的引导脚本和CSS文件?将Bootstrap留在该文件夹中并执行如下操作是否有意义?

<script src="./node_modules/bootstrap/dist/bootstrap.min.js"></script>

或者我必须在gulp文件中添加规则,然后将这些文件复制到dist文件夹中?或者最好让gulp以某种方式完全从我的HTML文件中删除本地引导,并将其替换为CDN版本?

我正在阅读tsconfig中的路径映射。json,我想用它来避免使用以下丑陋的路径:

项目组织有点奇怪,因为我们有一个包含项目和库的单一存储库。项目按公司和浏览器/服务器/通用进行分组。

如何配置tsconfig中的路径?Json,而不是:

import { Something } from "../../../../../lib/src/[browser/server/universal]/...";

我可以使用:

import { Something } from "lib/src/[browser/server/universal]/...";

webpack配置中还需要其他东西吗?或者是tsconfig。json足够了吗?

我正在尝试将nodeJs安装到我的Ubuntu 14.04中,以便使用GruntJs。

我读过关于Ubuntu不同的安装方法(问题?),所以我是这样安装它的:

sudo apt-get install npm

sudo npm install -g grunt-cli

输入grunt之后,我得到了错误:

/usr/bin/env: node: No such file or directory

所以,我试过:

curl -sL https://deb.nodesource.com/setup | sudo bash -

sudo apt-get install -y nodejs

sudo apt-get update

再次尝试,仍然得到错误,我尝试了:

sudo add-apt-repository https://launchpad.net/~chris-lea/+archive/node.js/

sudo apt-get install -y nodejs

我得到了这个信息:

nodejs is already the newest version.
0 to upgrade, 0 to newly install, 0 to remove and 3 not to upgrade.

以防万一,我试着清理了一下:

sudo apt-get autoremove

但是,错误仍然存在:当我输入grunt时,我仍然得到/usr/bin/env: node: No这样的文件或目录

我该怎么办?

如何通过命令行或批处理脚本与ffmpeg转换整个目录/文件夹?

我想配置Visual Studio打开超越比较默认作为差异工具。我该怎么做呢?

我一直试图弄清楚如何旋转视频与FFmpeg。我正在处理以竖屏模式拍摄的iPhone视频。我知道如何使用MediaInfo(优秀的库,顺便说一下)确定当前的旋转程度,但我现在卡住了FFmpeg。

从我所读到的,你需要使用的是一个vfilter选项。根据我看到的,它应该是这样的:

ffmpeg -vfilters "rotate=90" -i input.mp4 output.mp4

然而,我不能让它工作。首先,-vfilters已经不存在了,现在只有-vf。其次,我得到这个错误:

No such filter: 'rotate'
Error opening filters!

据我所知,我有一个全选项的FFmpeg构建。运行ffmpeg -filters显示:

Filters:
anull            Pass the source unchanged to the output.
aspect           Set the frame aspect ratio.
crop             Crop the input video to x:y:width:height.
fifo             Buffer input images and send them when they are requested.
format           Convert the input video to one of the specified pixel formats.
hflip            Horizontally flip the input video.
noformat         Force libavfilter not to use any of the specified pixel formats
 for the input to the next filter.
null             Pass the source unchanged to the output.
pad              Pad input image to width:height[:x:y[:color]] (default x and y:
 0, default color: black).
pixdesctest      Test pixel format definitions.
pixelaspect      Set the pixel aspect ratio.
scale            Scale the input video to width:height size and/or convert the i
mage format.
slicify          Pass the images of input video on to next video filter as multi
ple slices.
unsharp          Sharpen or blur the input video.
vflip            Flip the input video vertically.
buffer           Buffer video frames, and make them accessible to the filterchai
n.
color            Provide an uniformly colored input, syntax is: [color[:size[:ra
te]]]
nullsrc          Null video source, never return images.
nullsink         Do absolutely nothing with the input video.

拥有vflip和hflip的选项很棒,但它们不能让我去我需要去的地方。我需要至少能够将视频旋转90度。270度也是个不错的选择。旋转选项去哪儿了?

我尝试了以下命令从视频中提取音频:

ffmpeg -i Sample.avi -vn -ar 44100 -ac 2 -ab 192k -f mp3 Sample.mp3

但我得到了如下的输出

libavutil     50.15. 1 / 50.15. 1
libavcodec    52.72. 2 / 52.72. 2
libavformat   52.64. 2 / 52.64. 2
libavdevice   52. 2. 0 / 52. 2. 0
libavfilter    1.19. 0 /  1.19. 0
libswscale     0.11. 0 /  0.11. 0
libpostproc   51. 2. 0 / 51. 2. 0
SamplE.avi: Invalid data found when processing input

有人能帮忙吗?

我有一个ApolloServer项目,它给我带来了麻烦,所以我想我可能会更新它,但在使用最新的Babel时遇到了问题。我的index.js是:

require('dotenv').config()
import {startServer} from './server'
startServer()

当我运行它时,我得到了错误

SyntaxError: Cannot use import statement outside a module

首先,我试图说服TPTB*这是一个模块(没有成功)。所以我把“import”改成了“require”,这就成功了。

但现在我在其他文件中有大约24个“导入”给我同样的错误。

*我敢肯定我问题的根源是我甚至不知道抱怨的是什么。我有点假设它是巴别塔7(因为我来自巴别塔6,我不得不改变预设),但我不是100%确定。

我发现的大多数解决方案似乎并不适用于直节点。比如这个:

ES6模块导入给出“未捕获SyntaxError:意外标识符”

说它是通过添加“type=module”来解决的,但这通常会在HTML中,其中我没有。我也尝试使用我的项目的旧预设:

"presets": ["es2015", "stage-2"],
"plugins": []

但这又给了我另一个错误:“错误:插件/预设文件不允许导出对象,只能导出函数。”

以下是我开始时的依赖关系:

"dependencies": {
"@babel/polyfill": "^7.6.0",
"apollo-link-error": "^1.1.12",
"apollo-link-http": "^1.5.16",
"apollo-server": "^2.9.6",
"babel-preset-es2015": "^6.24.1",