Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Video ffmpeg从H.264(高4:4:4配置文件)转换为H.264(主配置文件)_Video_Ffmpeg_Converter_Codec - Fatal编程技术网

Video ffmpeg从H.264(高4:4:4配置文件)转换为H.264(主配置文件)

Video ffmpeg从H.264(高4:4:4配置文件)转换为H.264(主配置文件),video,ffmpeg,converter,codec,Video,Ffmpeg,Converter,Codec,如何使用ffmpeg将视频从H.264(高4:4:4配置文件)转换为H.264(主配置文件) 我无法使用以下命令执行此操作:ffmpeg-I 1/25359.mp4-profile:v main out.mp4 这将返回一个错误: ... That'd return an error: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '1/25359.mp4': Metadata: major_brand : isom minor_ve

如何使用ffmpeg将视频从H.264(高4:4:4配置文件)转换为H.264(主配置文件)

我无法使用以下命令执行此操作:
ffmpeg-I 1/25359.mp4-profile:v main out.mp4

这将返回一个错误:

...
That'd return an error:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '1/25359.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.40.101
  Duration: 00:00:06.08, start: 0.000000, bitrate: 1059 kb/s
    Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 351x297, 1057 kb/s, 12.50 fps, 12.50 tbr, 12800 tbn, 25 tbc (default)
    Metadata:
      handler_name    : VideoHandler
No pixel format specified, yuv444p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
x264 [error]: main profile doesn't support 4:4:4
[libx264 @ 0x8fa9640] Error setting profile main.
[libx264 @ 0x8fa9640] Possible profiles: baseline main high high10 high422 high444
Output #0, mp4, to '1/24545.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.40.101
    Stream #0:0(und): Video: h264, none, q=2-31, 128 kb/s, 12.50 fps (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc56.60.100 libx264
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

您的源视频具有全尺寸的色度平面-如YUV444P中后两个4s所示-并且主配置文件不支持该格式,因此您必须选择像YUV4:2:0这样的像素格式

ffmpeg -i 1/25359.mp4 -vf "scale=2*trunc(iw/2):-2,setsar=1" -profile:v main -pix_fmt yuv420p out.mp4

前一个答案是正确的,但我认为下面的答案正是提问者想要的

ffmpeg -i 1/25359.mp4 -profile:v main -pix_fmt yuv420p out.mp4
  • -profile:v
    :表示要编码视频的模式,有一些选项
  • -pix_fmt
    :yuv420p适用于旧视频

只有一个问题。在每个视频中使用“-pix_fmt yuv420p”可以吗?我的意思是,它会给一些视频带来任何错误吗?它如何影响视频?(我只想创建一个好的ffmpeg命令,在我的网站上使用它。)对于网络播放,你必须使用它。这是唯一受支持的像素格式。这对我来说是可行的,尽管此设置我的视频与whatsapp和其他社交媒体兼容。这些选项的目标是:-vf“scale=2*trunc(iw/2):-2,setsar=1”?scale参数确保宽度和高度均匀。setsar强制采样宽高比为1,以便播放器在显示期间不会调整视频大小。