为什么使用FFmpeg缩放时帧计数会发生变化?
我用它来缩放1920x1080 H.264视频:为什么使用FFmpeg缩放时帧计数会发生变化?,ffmpeg,Ffmpeg,我用它来缩放1920x1080 H.264视频: ffmpeg -i IMG_1438.MOV -threads 2 -vf scale=-2:600 IMG_1438_scaledTo600.MOV !!但我的问题是:大多数情况下,原始文件和缩放文件之间的帧速率保持完全相同。例如: $ mediainfo -F IMG_1426.MOV | grep Frame\ rate Frame rate : 29.970 Frame rat
ffmpeg -i IMG_1438.MOV -threads 2 -vf scale=-2:600 IMG_1438_scaledTo600.MOV
!!但我的问题是:大多数情况下,原始文件和缩放文件之间的帧速率保持完全相同。例如:
$ mediainfo -F IMG_1426.MOV | grep Frame\ rate
Frame rate : 29.970
Frame rate : 29.970 FPS
Frame rate mode : VFR
Frame rate mode : Variable
Frame rate : 29.970
Frame rate : 29.970 (29970/1000) FPS
$ mediainfo -F IMG_1426_scaledTo600.MOV | grep Frame\ rate
Frame rate : 29.970
Frame rate : 29.970 FPS
Frame rate mode : CFR
Frame rate mode : Constant
Frame rate : 29.970
Frame rate : 29.970 (30000/1001) FPS
但有时,帧速率会急剧增加:
$ mediainfo -F IMG_1438.MOV | grep Frame\ rate
Frame rate : 25.044
Frame rate : 25.044 FPS
Frame rate mode : VFR
Frame rate mode : Variable
Frame rate : 25.044
Frame rate : 25.044 FPS
$ mediainfo -F IMG_1438_scaledTo600.MOV | grep Frame\ rate
Frame rate : 120.000
Frame rate : 120.000 FPS
Frame rate mode : CFR
Frame rate mode : Constant
Frame rate : 120.000
Frame rate : 120.000 FPS
关于FFmpeg、libx264或libswscale,我应该知道什么才能帮助我理解为什么会发生这种情况?(特别是希望收到你的来信)
mediainfo IMG_1438.MOV--完整输出:
General
Count : 327
Count of stream of this kind : 1
Kind of stream : General
Kind of stream : General
Stream identifier : 0
Count of video streams : 1
Count of audio streams : 1
OtherCount : 2
Video_Format_List : AVC
Video_Format_WithHint_List : AVC
Codecs Video : AVC
Audio_Format_List : AAC
Audio_Format_WithHint_List : AAC
Audio codecs : AAC LC
Complete name : IMG_1438.MOV
File name : IMG_1438
File extension : MOV
Format : MPEG-4
Format : MPEG-4
Format/Extensions usually used : mp4 m4v m4a m4b m4p 3gpp 3gp 3gpp2 3g2 k3g jpm jpx mqv ismv isma f4v
Commercial name : MPEG-4
Format profile : QuickTime
Internet media type : video/mp4
Codec ID : qt
Codec ID : qt 0000.00 (qt )
Codec ID/Url : http://www.apple.com/quicktime/download/standalone.html
CodecID_Version : 0000.00
CodecID_Compatible : qt
Codec : MPEG-4
Codec : MPEG-4
Codec/Extensions usually used : mp4 m4v m4a m4b m4p 3gpp 3gp 3gpp2 3g2 k3g jpm jpx mqv ismv isma f4v
File size : 113990140
File size : 109 MiB
File size : 109 MiB
File size : 109 MiB
File size : 109 MiB
File size : 108.7 MiB
Duration : 52268
Duration : 52 s 268 ms
Duration : 52 s 268 ms
Duration : 52 s 268 ms
Duration : 00:00:52.268
Duration : 00:00:52:09
Duration : 00:00:52.268 (00:00:52:09)
Overall bit rate : 17447026
Overall bit rate : 17.4 Mb/s
Frame rate : 25.044
Frame rate : 25.044 FPS
Frame count : 1309
Stream size : 56670
Stream size : 55.3 KiB (0%)
Stream size : 55 KiB
Stream size : 55 KiB
Stream size : 55.3 KiB
Stream size : 55.34 KiB
Stream size : 55.3 KiB (0%)
Proportion of this stream : 0.00050
HeaderSize : 28
DataSize : 113966271
FooterSize : 23841
IsStreamable : No
Encoded date : UTC 2016-10-08 22:51:19
Tagged date : UTC 2016-10-08 22:52:12
File last modification date : UTC 2016-10-08 22:51:19
File last modification date (local) : 2016-10-08 17:51:19
Writing library : Apple QuickTime
Writing library : Apple QuickTime
Encoded_Library_Name : Apple QuickTime
com.apple.quicktime.make : Apple
com.apple.quicktime.model : iPhone 5
com.apple.quicktime.software : 10.0.2
com.apple.quicktime.creationdate : 2016-10-08T17:51:19-0500
Video
Count : 334
Count of stream of this kind : 1
Kind of stream : Video
Kind of stream : Video
Stream identifier : 0
StreamOrder : 0
ID : 1
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format/Url : http://developers.videolan.org/x264.html
Commercial name : AVC
Format profile : High@L4.1
Format settings : CABAC / 1 Ref Frames
Format settings, CABAC : Yes
Format settings, CABAC : Yes
Format settings, ReFrames : 1
Format settings, ReFrames : 1 frame
Internet media type : video/H264
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Codec ID/Url : http://www.apple.com/quicktime/download/standalone.html
Codec : AVC
Codec : AVC
Codec/Family : AVC
Codec/Info : Advanced Video Codec
Codec/Url : http://developers.videolan.org/x264.html
Codec/CC : avc1
Codec profile : High@L4.1
Codec settings : CABAC / 1 Ref Frames
Codec settings, CABAC : Yes
Codec_Settings_RefFrames : 1
Duration : 52268
Duration : 52 s 268 ms
Duration : 52 s 268 ms
Duration : 52 s 268 ms
Duration : 00:00:52.268
Duration : 00:00:52:09
Duration : 00:00:52.268 (00:00:52:09)
Bit rate : 17375530
Bit rate : 17.4 Mb/s
Width : 1920
Width : 1 920 pixels
Height : 1080
Height : 1 080 pixels
Stored_Height : 1088
Sampled_Width : 1920
Sampled_Height : 1080
Pixel aspect ratio : 1.000
Display aspect ratio : 1.778
Display aspect ratio : 16:9
Rotation : 90.000
Rotation : 90°
Frame rate mode : VFR
Frame rate mode : Variable
Frame rate : 25.044
Frame rate : 25.044 FPS
Minimum frame rate : 23.077
Minimum frame rate : 23.077 FPS
Maximum frame rate : 30.000
Maximum frame rate : 30.000 FPS
Frame count : 1309
Resolution : 8
Resolution : 8 bits
Colorimetry : 4:2:0
Color space : YUV
Chroma subsampling : 4:2:0
Chroma subsampling : 4:2:0
Bit depth : 8
Bit depth : 8 bits
Scan type : Progressive
Scan type : Progressive
Interlacement : PPF
Interlacement : Progressive
Bits/(Pixel*Frame) : 0.335
Stream size : 113523046
Stream size : 108 MiB (100%)
Stream size : 108 MiB
Stream size : 108 MiB
Stream size : 108 MiB
Stream size : 108.3 MiB
Stream size : 108 MiB (100%)
Proportion of this stream : 0.99590
Title : Core Media Video
Encoded date : UTC 2016-10-08 22:51:19
Tagged date : UTC 2016-10-08 22:52:12
Color range : Limited
colour_description_present : Yes
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709
Audio
Count : 272
Count of stream of this kind : 1
Kind of stream : Audio
Kind of stream : Audio
Stream identifier : 0
StreamOrder : 1
ID : 2
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Commercial name : AAC
Format profile : LC
Codec ID : 40
Codec : AAC LC
Codec : AAC LC
Codec/Family : AAC
Codec/CC : 40
Duration : 52268
Duration : 52 s 268 ms
Duration : 52 s 268 ms
Duration : 52 s 268 ms
Duration : 00:00:52.268
Duration : 00:00:52:15
Duration : 00:00:52.268 (00:00:52:15)
Source duration : 52338
Source duration : 52 s 338 ms
Source duration : 52 s 338 ms
Source duration : 52 s 338 ms
Source duration : 00:00:52.338
Bit rate mode : CBR
Bit rate mode : Constant
Bit rate : 64000
Bit rate : 64.0 kb/s
Channel(s) : 1
Channel(s) : 1 channel
Channel positions : Front: C
Channel positions : 1/0/0
ChannelLayout : C
Samples per frame : 1024
Sampling rate : 44100
Sampling rate : 44.1 kHz
Samples count : 2305019
Frame rate : 43.066
Frame rate : 43.066 FPS (1024 spf)
Frame count : 2251
Source frame count : 2254
Compression mode : Lossy
Compression mode : Lossy
Stream size : 410424
Stream size : 401 KiB (0%)
Stream size : 401 KiB
Stream size : 401 KiB
Stream size : 401 KiB
Stream size : 400.8 KiB
Stream size : 401 KiB (0%)
Proportion of this stream : 0.00360
Source stream size : 410894
Source stream size : 401 KiB (0%)
Source stream size : 401 KiB
Source stream size : 401 KiB
Source stream size : 401 KiB
Source stream size : 401.3 KiB
Source stream size : 401 KiB (0%)
Source_StreamSize_Proportion : 0.00360
Title : Core Media Audio
Encoded date : UTC 2016-10-08 22:51:19
Tagged date : UTC 2016-10-08 22:52:12
Other #1
Count : 112
Count of stream of this kind : 2
Kind of stream : Other
Kind of stream : Other
Stream identifier : 0
Stream identifier : 1
Type : meta
Duration : 52268
Duration : 52 s 268 ms
Duration : 52 s 268 ms
Duration : 52 s 268 ms
Duration : 00:00:52.268
Duration : 00:00:52.268
Frame count : 6
Bit rate mode : VBR
Other #2
Count : 112
Count of stream of this kind : 2
Kind of stream : Other
Kind of stream : Other
Stream identifier : 1
Stream identifier : 2
Type : meta
Duration : 52268
Duration : 52 s 268 ms
Duration : 52 s 268 ms
Duration : 52 s 268 ms
Duration : 00:00:52.268
Duration : 00:00:52.268
Frame count : 1
Bit rate mode : CBR
ffprobe version 3.1.3 Copyright (c) 2007-2016 the FFmpeg developers
built with Apple LLVM version 7.3.0 (clang-703.0.31)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.1.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --disable-lzma --enable-vda
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 48.101 / 57. 48.101
libavformat 57. 41.100 / 57. 41.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 47.100 / 6. 47.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'IMG_1438.MOV':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2016-10-08 22:51:19
com.apple.quicktime.make: Apple
com.apple.quicktime.model: iPhone 5
com.apple.quicktime.software: 10.0.2
com.apple.quicktime.creationdate: 2016-10-08T17:51:19-0500
Duration: 00:00:52.27, start: 0.000000, bitrate: 17446 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 17375 kb/s, 25.04 fps, 120 tbr, 600 tbn, 1200 tbc (default)
Metadata:
rotate : 90
creation_time : 2016-10-08 22:51:19
handler_name : Core Media Data Handler
encoder : H.264
Side data:
displaymatrix: rotation of -90.00 degrees
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 62 kb/s (default)
Metadata:
creation_time : 2016-10-08 22:51:19
handler_name : Core Media Data Handler
Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
Metadata:
creation_time : 2016-10-08 22:51:19
handler_name : Core Media Data Handler
Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
Metadata:
creation_time : 2016-10-08 22:51:19
handler_name : Core Media Data Handler
Unsupported codec with id 0 for input stream 2
Unsupported codec with id 0 for input stream 3
和ffprobe IMG_1438.MOV
输出:
General
Count : 327
Count of stream of this kind : 1
Kind of stream : General
Kind of stream : General
Stream identifier : 0
Count of video streams : 1
Count of audio streams : 1
OtherCount : 2
Video_Format_List : AVC
Video_Format_WithHint_List : AVC
Codecs Video : AVC
Audio_Format_List : AAC
Audio_Format_WithHint_List : AAC
Audio codecs : AAC LC
Complete name : IMG_1438.MOV
File name : IMG_1438
File extension : MOV
Format : MPEG-4
Format : MPEG-4
Format/Extensions usually used : mp4 m4v m4a m4b m4p 3gpp 3gp 3gpp2 3g2 k3g jpm jpx mqv ismv isma f4v
Commercial name : MPEG-4
Format profile : QuickTime
Internet media type : video/mp4
Codec ID : qt
Codec ID : qt 0000.00 (qt )
Codec ID/Url : http://www.apple.com/quicktime/download/standalone.html
CodecID_Version : 0000.00
CodecID_Compatible : qt
Codec : MPEG-4
Codec : MPEG-4
Codec/Extensions usually used : mp4 m4v m4a m4b m4p 3gpp 3gp 3gpp2 3g2 k3g jpm jpx mqv ismv isma f4v
File size : 113990140
File size : 109 MiB
File size : 109 MiB
File size : 109 MiB
File size : 109 MiB
File size : 108.7 MiB
Duration : 52268
Duration : 52 s 268 ms
Duration : 52 s 268 ms
Duration : 52 s 268 ms
Duration : 00:00:52.268
Duration : 00:00:52:09
Duration : 00:00:52.268 (00:00:52:09)
Overall bit rate : 17447026
Overall bit rate : 17.4 Mb/s
Frame rate : 25.044
Frame rate : 25.044 FPS
Frame count : 1309
Stream size : 56670
Stream size : 55.3 KiB (0%)
Stream size : 55 KiB
Stream size : 55 KiB
Stream size : 55.3 KiB
Stream size : 55.34 KiB
Stream size : 55.3 KiB (0%)
Proportion of this stream : 0.00050
HeaderSize : 28
DataSize : 113966271
FooterSize : 23841
IsStreamable : No
Encoded date : UTC 2016-10-08 22:51:19
Tagged date : UTC 2016-10-08 22:52:12
File last modification date : UTC 2016-10-08 22:51:19
File last modification date (local) : 2016-10-08 17:51:19
Writing library : Apple QuickTime
Writing library : Apple QuickTime
Encoded_Library_Name : Apple QuickTime
com.apple.quicktime.make : Apple
com.apple.quicktime.model : iPhone 5
com.apple.quicktime.software : 10.0.2
com.apple.quicktime.creationdate : 2016-10-08T17:51:19-0500
Video
Count : 334
Count of stream of this kind : 1
Kind of stream : Video
Kind of stream : Video
Stream identifier : 0
StreamOrder : 0
ID : 1
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format/Url : http://developers.videolan.org/x264.html
Commercial name : AVC
Format profile : High@L4.1
Format settings : CABAC / 1 Ref Frames
Format settings, CABAC : Yes
Format settings, CABAC : Yes
Format settings, ReFrames : 1
Format settings, ReFrames : 1 frame
Internet media type : video/H264
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Codec ID/Url : http://www.apple.com/quicktime/download/standalone.html
Codec : AVC
Codec : AVC
Codec/Family : AVC
Codec/Info : Advanced Video Codec
Codec/Url : http://developers.videolan.org/x264.html
Codec/CC : avc1
Codec profile : High@L4.1
Codec settings : CABAC / 1 Ref Frames
Codec settings, CABAC : Yes
Codec_Settings_RefFrames : 1
Duration : 52268
Duration : 52 s 268 ms
Duration : 52 s 268 ms
Duration : 52 s 268 ms
Duration : 00:00:52.268
Duration : 00:00:52:09
Duration : 00:00:52.268 (00:00:52:09)
Bit rate : 17375530
Bit rate : 17.4 Mb/s
Width : 1920
Width : 1 920 pixels
Height : 1080
Height : 1 080 pixels
Stored_Height : 1088
Sampled_Width : 1920
Sampled_Height : 1080
Pixel aspect ratio : 1.000
Display aspect ratio : 1.778
Display aspect ratio : 16:9
Rotation : 90.000
Rotation : 90°
Frame rate mode : VFR
Frame rate mode : Variable
Frame rate : 25.044
Frame rate : 25.044 FPS
Minimum frame rate : 23.077
Minimum frame rate : 23.077 FPS
Maximum frame rate : 30.000
Maximum frame rate : 30.000 FPS
Frame count : 1309
Resolution : 8
Resolution : 8 bits
Colorimetry : 4:2:0
Color space : YUV
Chroma subsampling : 4:2:0
Chroma subsampling : 4:2:0
Bit depth : 8
Bit depth : 8 bits
Scan type : Progressive
Scan type : Progressive
Interlacement : PPF
Interlacement : Progressive
Bits/(Pixel*Frame) : 0.335
Stream size : 113523046
Stream size : 108 MiB (100%)
Stream size : 108 MiB
Stream size : 108 MiB
Stream size : 108 MiB
Stream size : 108.3 MiB
Stream size : 108 MiB (100%)
Proportion of this stream : 0.99590
Title : Core Media Video
Encoded date : UTC 2016-10-08 22:51:19
Tagged date : UTC 2016-10-08 22:52:12
Color range : Limited
colour_description_present : Yes
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709
Audio
Count : 272
Count of stream of this kind : 1
Kind of stream : Audio
Kind of stream : Audio
Stream identifier : 0
StreamOrder : 1
ID : 2
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Commercial name : AAC
Format profile : LC
Codec ID : 40
Codec : AAC LC
Codec : AAC LC
Codec/Family : AAC
Codec/CC : 40
Duration : 52268
Duration : 52 s 268 ms
Duration : 52 s 268 ms
Duration : 52 s 268 ms
Duration : 00:00:52.268
Duration : 00:00:52:15
Duration : 00:00:52.268 (00:00:52:15)
Source duration : 52338
Source duration : 52 s 338 ms
Source duration : 52 s 338 ms
Source duration : 52 s 338 ms
Source duration : 00:00:52.338
Bit rate mode : CBR
Bit rate mode : Constant
Bit rate : 64000
Bit rate : 64.0 kb/s
Channel(s) : 1
Channel(s) : 1 channel
Channel positions : Front: C
Channel positions : 1/0/0
ChannelLayout : C
Samples per frame : 1024
Sampling rate : 44100
Sampling rate : 44.1 kHz
Samples count : 2305019
Frame rate : 43.066
Frame rate : 43.066 FPS (1024 spf)
Frame count : 2251
Source frame count : 2254
Compression mode : Lossy
Compression mode : Lossy
Stream size : 410424
Stream size : 401 KiB (0%)
Stream size : 401 KiB
Stream size : 401 KiB
Stream size : 401 KiB
Stream size : 400.8 KiB
Stream size : 401 KiB (0%)
Proportion of this stream : 0.00360
Source stream size : 410894
Source stream size : 401 KiB (0%)
Source stream size : 401 KiB
Source stream size : 401 KiB
Source stream size : 401 KiB
Source stream size : 401.3 KiB
Source stream size : 401 KiB (0%)
Source_StreamSize_Proportion : 0.00360
Title : Core Media Audio
Encoded date : UTC 2016-10-08 22:51:19
Tagged date : UTC 2016-10-08 22:52:12
Other #1
Count : 112
Count of stream of this kind : 2
Kind of stream : Other
Kind of stream : Other
Stream identifier : 0
Stream identifier : 1
Type : meta
Duration : 52268
Duration : 52 s 268 ms
Duration : 52 s 268 ms
Duration : 52 s 268 ms
Duration : 00:00:52.268
Duration : 00:00:52.268
Frame count : 6
Bit rate mode : VBR
Other #2
Count : 112
Count of stream of this kind : 2
Kind of stream : Other
Kind of stream : Other
Stream identifier : 1
Stream identifier : 2
Type : meta
Duration : 52268
Duration : 52 s 268 ms
Duration : 52 s 268 ms
Duration : 52 s 268 ms
Duration : 00:00:52.268
Duration : 00:00:52.268
Frame count : 1
Bit rate mode : CBR
ffprobe version 3.1.3 Copyright (c) 2007-2016 the FFmpeg developers
built with Apple LLVM version 7.3.0 (clang-703.0.31)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.1.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --disable-lzma --enable-vda
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 48.101 / 57. 48.101
libavformat 57. 41.100 / 57. 41.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 47.100 / 6. 47.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'IMG_1438.MOV':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2016-10-08 22:51:19
com.apple.quicktime.make: Apple
com.apple.quicktime.model: iPhone 5
com.apple.quicktime.software: 10.0.2
com.apple.quicktime.creationdate: 2016-10-08T17:51:19-0500
Duration: 00:00:52.27, start: 0.000000, bitrate: 17446 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 17375 kb/s, 25.04 fps, 120 tbr, 600 tbn, 1200 tbc (default)
Metadata:
rotate : 90
creation_time : 2016-10-08 22:51:19
handler_name : Core Media Data Handler
encoder : H.264
Side data:
displaymatrix: rotation of -90.00 degrees
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 62 kb/s (default)
Metadata:
creation_time : 2016-10-08 22:51:19
handler_name : Core Media Data Handler
Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
Metadata:
creation_time : 2016-10-08 22:51:19
handler_name : Core Media Data Handler
Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
Metadata:
creation_time : 2016-10-08 22:51:19
handler_name : Core Media Data Handler
Unsupported codec with id 0 for input stream 2
Unsupported codec with id 0 for input stream 3
更新
为了澄清:我上面的视频,在缩放后具有高帧率(120 FPS)输出的视频,在使用FFmpeg缩放前后都能完美播放(没有同步问题,120 FPS的文件大小仅大14%),我只是想理解为什么帧率会增加(稍微超出Mulvya的注意,存储在容器中的帧速率是错误的)
从编程的角度来看,我遇到的最初问题是,我使用FFmpeg的sterr控制台输出中的frame=
来确定进度,当输出中的帧数急剧增加时,会报告错误的结果(“我编码完成372%?);此后,我将代码改为使用time=
,这似乎是显示FFmpeg进度的一种更可靠的方式。(当然,还有FFmpeg的-progress
选项)
改进原有命令
我的新命令用于缩放、保留有用的帧速率和优化线程:
ffmpeg-i IMG_1438.MOV-vf scale=-2:600-r30-vsync0 IMG_1438_scaledTo600.MOV
其中30
是来自mediainfo
的“最大帧速率”
感谢评论中的帮助,我现在知道我并不完全理解FFmpeg对时间戳使用的三种不同时基:tbn
、tbc
、和tbr
他们被解释了,他的解释也被用来解释
在我收集下面Mulvya的评论时,我觉得,tbr
是猜测出来的;当从可变帧速率视频更改为恒定帧速率视频时,这通常是但并不总是最佳值
剩下这两个问题……
(1) tbr
不同时不正确?这种情况经常发生吗?
(2) -r 30
其中30
是mediainfo
报告的最大帧速率对于大多数编解码器/容器组合来说是最好的方法吗?(或者我应该只在缩放H.264/MPEG-4 AVC视频时使用此方法吗?(1)当“场速率和帧速率”不同时,tbr是不正确的?这种情况经常发生吗
取决于编码/渲染应用程序和使用的编解码器。请注意,tbr
指的是帧速率,而不是字段速率。50个字段对仍存储在25帧中。因此,这本身不是答案
(2) Is-r=30,其中30是mediainfo报告的最大帧速率,这是最好的方法
如果您希望编码到恒定帧速率流,则可以添加-r max
(中间没有=
符号).else只使用-vsync 0
。默认情况下,FFmpeg在输出到MOV/MP4时编码到CRF流,并且它引用tbr
作为要使用的值。因此,当流实际包含较少的帧时,它复制帧以便满足tbr
值。使用CFR编码的最大帧速率的原因是t因此不会删除任何帧。如果值较低,输入的部分将包含更多帧,ffmpeg将删除以满足您设置的r
。您的源文件是可变速率的。因此,1438的间隔大于25帧,或者容器中存储的帧速率错误。请使用ffmpeg-i IMG_1438.MOV-threads 2-vf scale=-2:600-vsync 0 IMG_1438_scaledto 600.MOV
但显示1438的ffprobe和mediainfor的完整输出。@ajmicek我可以说Mulvya没有。控制台输出会很有帮助。未删除,但可以删除-threads 2
,让libx264自动选择最佳线程数。我已经添加了mediainfo
和ffprobe
的完整输出。感谢你们两位的想法。ffprobe将容器存储的帧率显示为120(120 tbr
)。将-r 30-vsync 0
添加到您的命令中。(使用30作为视频期间的最大速率,请参阅完整的mediainfo输出;视频部分)根据你们两人的输入更新了我的问题代码,还有两个关于tbr
的问题。你们都帮了我很大的忙,我真的很感激。我的代码正确地输出了ffmpeg
命令;我只是一直打等号!(我应该把我代码的输出复制并粘贴到这里。)谢谢你的语法更正。你的回答抓住了问题的关键,你关于ffmpeg
默认行为的注释特别有用,因为我愿意深入了解它的来源,但我的结论充其量是模棱两可的。这个对话帮助我了解了我的u我发现这对填补我理解上的空白特别有帮助。