gpt4 book ai didi

video - 使用ffmpeg将WMV转换为mp4获取黑屏

转载 作者:行者123 更新时间:2023-12-04 22:51:47 24 4
gpt4 key购买 nike

将 .wmv 文件转换为 .mp4 时,我使用了以下命令:

exec("ffmpeg -i file.wmv -vcodec mpeg4 -acodec libfaac -b 1200 -r 15 -s 320x240 -pix_fmt yuv420p file.mp4");

声音很好,但我没有图像(下载到电脑时不使用 html5)。
这是输出:

FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developers
built on Jan 29 2012 17:52:15 with gcc 4.4.5 20110214 (Red Hat 4.4.5-6)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --enable-avfilter --enable-avfilter-lavf --enable-libdc1394 --enable-libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab
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
[wmv3 @ 0xc2daa0]Extra data: 8 bits left, value: 20

Seems stream 1 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 30.00 (30/1)
Input #0, asf, from '/home/xxx/public_html/new/zawmju.wmv':
Metadata:
Application : Windows Movie Maker 2.6.4037.0
WM/ParentalRating:
WMFSDKVersion : 12.0.9200.16384
WMFSDKNeeded : 0.0.0.0000
IsVBR : 0
title :
author : SahlaTube
copyright :
comment :
Duration: 00:00:04.03, start: 2.000000, bitrate: 740 kb/s
Stream #0.0: Audio: wmav2, 44100 Hz, 2 channels, s16, 64 kb/s
Stream #0.1: Video: wmv3, yuv420p, 640x480, 30 tbr, 1k tbn, 1k tbc
[wmv3 @ 0xc2daa0]Extra data: 8 bits left, value: 20
Output #0, mp4, to '/home/xxx/public_html/new/zawmju.wmv.mp4':
Metadata:
encoder : Lavf52.64.2
Stream #0.0: Video: mpeg4, yuv420p, 320x240, q=2-31, 1 kb/s, 15 tbn, 15 tbc
Stream #0.1: Audio: libfaac, 44100 Hz, 2 channels, s16, 64 kb/s
Stream mapping:
Stream #0.1 -> #0.0
Stream #0.0 -> #0.1
Press [q] to stop encoding
frame= 61 fps= 0 q=24.8 Lsize= 82kB time=4.02 bitrate= 166.4kbits/s dup=0 drop=59

video:55kB audio:24kB global headers:0kB muxing overhead 3.828952%

最佳答案

首先升级您的ffmpeg版本,然后将编码器更改为 libx264 (H.264 视频)而不是 mpeg4 (MPEG-4 第 2 部分视频):

ffmpeg -i file.wmv -vcodec libx264 -pix_fmt yuv420p -profile:v baseline \
-preset slow -crf 22 -movflags +faststart output.mp4

您可以使用 scale video filter根据需要调整大小,例如 -vf scale=320:-2 .

另见:
  • The right way to encode HTML5 video and audio
  • FFmpeg H.264 Video Encoding Guide
  • FFmpeg AAC Audio Encoding Guide
  • 关于video - 使用ffmpeg将WMV转换为mp4获取黑屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25924466/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com