管道输入到ffmpeg stdin [英] Pipe input in to ffmpeg stdin

查看:186
本文介绍了管道输入到ffmpeg stdin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用ffmpeg解码音频数据.虽然它可以从文件加载,但我想避免使用文件,因为这样做意味着我将不得不使用临时文件.取而代之的是,我想使用stdin传递数据(我之前已经加载过).

I am trying to use ffmpeg to decode audio data. While it works to load from a file, I would like to avoid using files because to do so, means I would have to use a temporary. Instead, I'd like to pipe in the data(which I've previously loaded) using stdin.

这可能吗?

例如

  1. 手动加载mp3文件
  2. 将其插入ffmpeg生成的进程
  3. 获取原始输出

(它也应与ffprobe和ffplay一起使用)

(it should work with ffprobe and ffplay also)

推荐答案

ffmpeg具有特殊的管道标志,该标志指示程序使用stdin.请注意,几乎总是需要明确定义输入格式.

ffmpeg has a special pipe flag that instructs the program to consume stdin. note that almost always the input format needs to be defined explicitly.

示例(输出采用PCM签名的16位Little-endian格式):

example (output is in PCM signed 16-bit little-endian format):

cat file.mp3 | ffmpeg -f mp3 -i pipe: -c:a pcm_s16le -f s16le pipe:

管道文档位于此处
支持的音频类型是此处

这篇关于管道输入到ffmpeg stdin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆