- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 MP4 文件,我想将其转换为 MPEG4 文件。为此,我找到了 PythonVideoConvert 包。在 PyPI 页面上,给出了以下代码:
from converter import Converter
conv = Converter()
info = conv.probe('test/test1.avi')
PATH = 'C:/Users/.../'
convert = conv.convert(PATH +'Demo.mp4', PATH + 'Demo.mpeg4', {
'format': 'mpeg4',
'audio': {
'codec': 'aac',
'samplerate': 11025,
'channels': 2
},
'video': {
'codec': 'hevc',
'width': 720,
'height': 400,
'fps': 25
}})
当我运行这段代码时,
convert
对象被创建。但是,PATH 目录中没有 .mpeg4 视频。
for timecode in convert:
pass
这给出了错误:
Traceback (most recent call last):
File "<ipython-input-60-14c9225c3ac2>", line 1, in <module>
for timecode in convert:
File "C:\Users\20200016\Anaconda3\lib\site-packages\converter\__init__.py", line 229, in convert
optlist = self.parse_options(options, twopass)
File "C:\Users\20200016\Anaconda3\lib\site-packages\converter\__init__.py", line 60, in parse_options
raise ConverterError(f'Requested unknown format: {str(f)}')
ConverterError: Requested unknown format: mpeg4
所以,我建议的格式似乎不正确。如何将视频转换为 .mpeg4?
最佳答案
我不认为PythonVideoConverter旨在在 Windows 中使用。
我遇到了一个异常 AttributeError: module 'signal' has no attribute 'SIGVTALRM'
, 因为 SIGVTALRM
不是 Windows 中的有效信号。
FFmpeg 和 FFprobe 命令行工具的默认路径,对于 Windows 也没有意义。
在 Windows 中我们仍然可以使用该包,但建议设置 ffmpeg_path
和 ffprobe_path
.
例子:
conv = Converter(ffmpeg_path=r'c:\FFmpeg\bin\ffmpeg.exe', ffprobe_path=r'c:\FFmpeg\bin\ffprobe.exe')
我们还必须通过设置
timeout=None
来禁用超时功能。争论。
mpeg4
不是有效的 FFmpeg 格式,但我们仍然可以将其用作文件扩展名。
format
入口。
'format': 'mp4'
创建 MP4 文件容器(可以使用非标准
.mpeg4
文件扩展名创建)。
from converter import Converter
conv = Converter(ffmpeg_path=r'c:\FFmpeg\bin\ffmpeg.exe', ffprobe_path=r'c:\FFmpeg\bin\ffprobe.exe')
#info = conv.probe('test/test1.avi')
PATH = 'C:/Users/Rotem/'
convert = conv.convert(PATH + 'Demo.mp4', PATH + 'Demo.mpeg4', {
'format': 'mp4', #'format': 'mpeg4',
'audio': {
'codec': 'aac',
'samplerate': 11025,
'channels': 2
},
'video': {
'codec': 'hevc',
'width': 720,
'height': 400,
'fps': 25
}},
timeout=None)
# https://pypi.org/project/PythonVideoConverter/
for timecode in convert:
print(f'\rConverting ({timecode:.2f}) ...')
Demo.mpeg4
的媒体信息使用
MediaInfo工具:
General
Complete name : C:\Users\Rotem\Demo.mpeg4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/mp41)
File size : 207 KiB
Duration : 10 s 148 ms
Overall bit rate mode : Variable
Overall bit rate : 167 kb/s
Writing application : Lavf58.45.100
FileExtension_Invalid : braw mov mp4 m4v m4a m4b m4p m4r 3ga 3gpa 3gpp 3gp 3gpp2 3g2 k3g jpm jpx mqv ismv isma ismt f4a f4b f4v
Video
ID : 1
Format : HEVC
Format/Info : High Efficiency Video Coding
Format profile : Main@L3@Main
Codec ID : hev1
Codec ID/Info : High Efficiency Video Coding
Duration : 10 s 0 ms
Bit rate : 82.5 kb/s
Width : 720 pixels
Height : 400 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 25.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.011
Stream size : 101 KiB (49%)
Writing library : x265 3.4+28-419182243:[Windows][GCC 9.3.0][64 bit] 8bit+10bit+12bit
Encoding settings : ...
Color range : Limited
Codec configuration box : hvcC
Audio
ID : 2
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Codec ID : mp4a-40-2
Duration : 10 s 148 ms
Duration_LastFrame : -70 ms
Bit rate mode : Variable
Bit rate : 79.1 kb/s
Maximum bit rate : 128 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 11.025 kHz
Frame rate : 10.767 FPS (1024 SPF)
Compression mode : Lossy
Stream size : 98.0 KiB (47%)
Title : IsoMedia File Produced by Google, 5-11-2011
Language : English
Default : Yes
Alternate group : 1
关于python-3.x - 使用转换器将 .mp4 转换为 .mpeg4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70842018/
我正在创建一个播放静态 mpeg-DASH 文件的应用程序。我一直在使用 MP4Box 创建 DASH .mp4 和 .mpd 文件。 MPD 文件包含单个 .mp4 文件中的字节范围偏移列表。这工作
我检查了一些 MPEG-4 视频 header ,并在开头看到了一些字节数组,如下所示: 00 00 01 B0 01 00 00 01 B5 89 13 我知道 00 00 01 部分,但 B0 B
我正在尝试实现用于播放受 widevine 保护的视频的 Android 应用程序。我在 Exoplayer 上构建我的应用程序,但我遇到了 MediaDrm 问题。 android.media.Me
我正在寻找区分使用 MPEG-1 和 MPEG-2 容器的文件的具体方法,因为我发现的大多数资源都表明这两个容器的起始代码都是 00 00 01 BA。 我尝试使用 VLC 的 GUI 将 MP4 容
我已经编写了 MPEG-TS 解复用器。它将传输流解包为 PES 数据包。现在我想丢弃所有帧,直到遇到关键帧。 我该怎么做?我应该在每个 PES 帧中找到序列 block 吗? 最佳答案 您应该能够在
我正在尝试能够从 MPEG、MPEG-TS 和 MPEG-PS 文件以及实时流(网络/UDP/RTP 流)中挑选出帧(视频和元数据)。我正在研究使用 JCODEC 来执行此操作,我开始尝试使用 Fra
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许在 Stack Overflow 上提出有关通用计算硬件和软件的问题。您可以编辑问题,使其成为
在带有 ARM 和/DSP 的 Android 平台上,哪个解码器会更快:MPEG-4 或 MPEG-2 还是 3GP?为什么? 谢谢 最佳答案 “更快”是一个相对术语。鉴于您问题中的信息,无法回答。
通过 UDP 流式传输,我有一个 MPEG Transport Stream包含: MPEG-2 视频和 MPEG-1 音频,或 H.264 视频和 MPEG-1 音频,或 H.264 视频和 AC3
我对编解码器了解较少。我所知道的编解码器代表解码/编码。在编解码器中将内置在手机中,外部库可以用作替代方案。编解码器对音频\视频起着重要作用,其中格式已编码为文件并解码以播放它们。 问题: Andro
我不知道我需要在哪个标签上问这个问题。 我目前正在研究数字电视广播的 ATSC 标准。我在浏览内容时有疑问。在数字电视广播中,一个带宽将包含多个 channel (服务)。 由广播公司编码和复用的数据
MPEG中节目时钟引用(PCR)的最大值是多少? 据我了解,它源自 27MHz 时钟,定期加载到 42 位寄存器中。 PCR(i)=PCR_Base(i) * 300 + PCR_Ext(i) 其中
我有一些与将 mpeg PES 流(打包)多路复用到 mpeg TS 相关的问题。 为什么 DTS 和 PTS 值包含在 PES 头中,而 PCR 值包含在传输流头中? 如果我们想以某种方式播放 PE
关闭。这个问题需要更多 focused .它目前不接受答案。 想改进这个问题?更新问题,使其仅关注一个问题 editing this post . 1年前关闭。 Improve this questi
。我试图了解 mpd 文件如何播放,我指的是以下数据集: http://www-itec.uni-klu.ac.at/ftp/datasets/mmsys12/Valkaama/MPDs/Valkaa
我正在尝试将几个 .wav 文件转换为 .mp3 格式 所需的 .mp3 格式是: 我尝试使用 FFmpeg 使用以下代码: ffmpeg -i input.wav -vn -ac 2 -b:a 16
我有一个支持 CENC 的 MPD 剪辑,如何在不使用任何特定 DRM 引擎的情况下解密和播放?是否有任何解密算法可用于解密 AES CTR 128 位?如果有,它将用于解密 MPEG-DASH 内容
以下是MPEG2VideoDescriptor的十六进制转储: 06 0e 2b 34 02 53 01 01 0d 01 01 01 01 01 51 00 83 00 00 f3 3c 0a 00
我需要检测文件是否为 MPEG ADTS 文件。我已经四处搜索了它,但无论是我寻找得很糟糕还是其他东西,但我找不到我可以肯定地说某些文件具有 MPEG ADTS 格式的签名。 例如如果文件以这样的签名
我正在开发用于网络吞吐量测试的点对点视频流。两个对等点之间的网络支持低比特率传输。 我使用 OpenCV 为视频流制作了简单的 python 程序。 该程序从网络摄像头抓取视频帧并将其编码为 JPEG
我是一名优秀的程序员,十分优秀!