Linux 如何使用 ffmpeg 将 m4v 和 wmv 视频转换为 mp4 格式?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9032382/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 04:15:13  来源:igfitidea点击:

How to convert m4v and wmv videos to mp4 format using ffmpeg?

linuxffmpeg

提问by Balaji Kandasamy

I am using ffmpeg to convert videos to mp4 in my PHPMotion project. I am not able to convert wmv and m4v video to mp4 format. I've pasted the command that I used to convert wmv and m4v:

我在 PHPMotion 项目中使用 ffmpeg 将视频转换为 mp4。我无法将 wmv 和 m4v 视频转换为 mp4 格式。我已经粘贴了我用来转换 wmv 和 m4v 的命令:

ffmpeg -i 1.wmv -ab 128 -b 1200 test.mp4
ffmpeg -i 1.m4v -ab 128 -b 1200 test.mp4

When I use this codes, i got an error message:

当我使用此代码时,收到一条错误消息:

Output #0, mp4, to 'test.mp4':
    Stream #0.0: Video: mpeg4, yuv420p, 640x360, q=2-31, 1 kb/s, 90k tbn, 24 tbc
    Stream #0.1: Audio: 0x0000, 44100 Hz, stereo, s16, 0 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Unsupported codec for output stream #0.1

How can I solve this issue?

我该如何解决这个问题?

采纳答案by Mike 'Pomax' Kamermans

For those who still find this question today, because they're trying to play m4vfiles that their hardware or software generated, but none of the players they try will play them: m4vis not just a playable media container, but is also used as a pure stream format by a number of commonly used tools and video capture devices, so that it can be used to burn the video directly to disc. This is especially likely when you're using something like Adobe's Creative Suite set of tools for video production.

对于那些今天仍然发现这个问题的人,因为他们试图播放m4v他们的硬件或软件生成的文件,但他们尝试的播放器都不会播放它们:m4v不仅是可播放的媒体容器,而且还用作纯通过一些常用的工具和视频捕获设备的流格式,使其可用于将视频直接刻录到光盘。当您使用 Adob​​e 的 Creative Suite 工具集进行视频制作时,这种情况尤其可能发生。

To turn an "unplayable" m4vstream (that your capture device/software suggests should totally be playable) into the kind of video file you're used to, tell ffmpeg to copy the stream into an mp4container:

要将“无法播放”的m4v流(您的捕获设备/软件建议应该完全可播放)转换为您习惯的视频文件,请告诉 ffmpeg 将流复制到mp4容器中:

$> ffmpeg -i input.m4v -vcodec copy -acodec copy output.mp4

Or, using the combined a/v codec shorthand flag:

或者,使用组合的 a/v 编解码器速记标志:

$> ffmpeg -i input.m4v -c copy output.mp4

No actual encoding happens, so this will only take a few seconds, if not less. Done deal.

没有实际的编码发生,所以这将只需要几秒钟,如果不是更少的话。木已成舟。

回答by Pekka

Unsupported codec

不支持的编解码器

The audio stream of your file seems to be encoded in a format that ffmpeg doesn't understand.

您文件的音频流似乎以 ffmpeg 无法理解的格式编码。

Adding new codecs to ffmpeg is possible, but doesn't seem to be easy: See Adding new CODEC to ffmpeg

将新编解码器添加到 ffmpeg 是可能的,但似乎并不容易:请参阅 将新编解码器添加到 ffmpeg

回答by Hyman Hamilton

The following worked for me when all the other answers weren't converting the audio in my video:

当所有其他答案都没有转换我视频中的音频时,以下对我有用:

ffmpeg -y -i in.wmv out.mp4

ffmpeg -y -i in.wmv out.mp4

SOURCE: FFmpeg command list for video conversion

来源:用于视频转换的 FFmpeg 命令列表