重新采样H264视频以降低帧速率,同时保持高图像质量 [英] Re-sampling H264 video to reduce frame rate while maintaining high image quality
问题描述
以下是感兴趣的视频的mplayer输出:
Here's the mplayer output for a video of interest:
br@carina:/tmp$ mplayer foo.mov
mplayer: Symbol `ff_codec_bmp_tags' has different size in shared object, consider re-linking
MPlayer 1.0rc4-4.5.2 (C) 2000-2010 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing foo.mov.
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang eng
VIDEO: [H264] 1280x720 24bpp 59.940 fps 2494.2 kbps (304.5 kbyte/s)
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
==========================================================================
Opening audio decoder: [faad] AAC (MPEG2/4 Advanced Audio Coding)
AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 15999->176400)
Selected audio codec: [faad] afm: faad (FAAD AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
AO: [pulse] 44100Hz 2ch s16le (2 bytes per sample)
Starting playback...
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [vdpau] 1280x720 => 1280x720 Planar YV12
我想使用ffmpeg,mencoder或其他一些命令行视频转码器将此视频重新采样到较低的帧速率,而不会降低 image 的质量.也就是说,每个帧都应保持尽可能清晰.
I'd like to use ffmpeg, mencoder, or some other command-line video transcoder to re-sample this video to a lower framerate without loss of image quality. That is, each frame should remain as crisp as possible.
ffmpeg -i foo.mov -r 25 -vcodec copy bar.mov
- 达到了25fps的目标帧速率,但单个帧是块状".
mencoder -nosound -ovc copy foo.mov -ofps 25 -o bar.mov
- 视频实际上无法观看.
这似乎是一个足够简单的用例.我很惊讶明显的事情没有起作用.我的方法有问题吗?
This seems like a simple enough use case. I'm very surprised that obvious things are not working. Is there something wrong with my approach?
推荐答案
自2012年发布此帖子以来,发生了很多变化.我为像我这样的人从搜索引擎中找到答案提供了此答案.我祝您好运:
A lot has changed since this posting in 2012. I am adding this answer for people like me who find this from the search engines. I had good luck with the following:
ffmpeg -y -i source.mp4 -r 25 -s 160x90 -c:v libx264 -b:v 3M -strict -2 -movflags faststart destination.mp4
以下是每个参数的简要说明:
Here’s a short explanation on what every parameter does:
-
-y
:不询问而覆盖输出文件 -
-i source.mp4
:输入文件名 -
-r 25
:输出帧速率(以每秒帧数为单位) -
-s 160x90
:输出帧大小(以像素为单位)-插入缩放视频过滤器 -
-c:v libx264
:输出视频编码器-
-c:v
是-codec:v
和-vcodec
的缩写
-y
: overwrite output files without asking-i source.mp4
: input file name-r 25
: output frame rate (in frames per second)-s 160x90
: output frame size (in pixel) - inserts the scale video filter-c:v libx264
: output video encoder-c:v
is short for-codec:v
and-vcodec
有关更多详细信息,请参见官方文档.
For more details see the official documentation.
这篇关于重新采样H264视频以降低帧速率,同时保持高图像质量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
-