Я использую параметры ниже, чтобы закодировать видео. Источник:.ts AVC @ 10,000kbps @ 30fps:
ffmpeg -i source.ts -c:v libx264 -profile:v high -preset veryslow -b:v 1300k -an -pass 1 %PARAMS% nul.mp4
ffmpeg -i source.ts -c:v libx264 -profile:v high -preset veryslow -b:v 1300k -an -pass 2 %PARAMS% encoded.mp4
Когда я играю оригинальное видео, оно воспроизводится очень плавно, выглядит как 60 кадров в секунду. Но когда я играю закодированный файл mp4, мне кажется, что он играет на скорости 25 кадров в секунду или около того.
Я использую Media Player Classic HC x64.
Я проверил с MediaInfo. Оба файла читает:
Frame rate : 29.970 (30000/1001) FPS
Есть ли способ это исправить?
Обновление: вывод ffmpeg:
ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
libavutil 55. 34.101 / 55. 34.101
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.101 / 57. 56.101
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100
[h264 @ 0000000002508a60] mmco: unref short failure
Last message repeated 1 times
[mpegts @ 00000000024e2640] start time for stream 4 is not set in estimate_timings_from_pts
Input #0, mpegts, from 'D:\003.ts':
Duration: 00:29:00.13, start: 47722.528389, bitrate: 10930 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x101](por): Audio: aac_latm (HE-AAC) ([17][0][0][0] / 0x0011), 48000 Hz, stereo, fltp
Stream #0:2[0x102](por): Audio: aac_latm (HE-AAC) ([17][0][0][0] / 0x0011), 48000 Hz, stereo, fltp
Stream #0:3[0x103]: Data: bin_data ([6][0][0][0] / 0x0006)
Stream #0:4[0x104]: Data: bin_data ([6][0][0][0] / 0x0006)
[libx264 @ 00000000006aca00] using SAR=2603/2602
[libx264 @ 00000000006aca00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 00000000006aca00] profile Main, level 3.1
[libx264 @ 00000000006aca00] 264 - core 148 r2762 90a61ec - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x1:0 me=dia subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=4 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=abr mbtree=1 bitrate=1300 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'nul.mp4':
Metadata:
encoder : Lavf57.56.101
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 946x720 [SAR 5205:5203 DAR 347:264], q=-1--1, 1300 kb/s, 29.97 fps, 30k tbn, 29.97 tbc
Metadata:
encoder : Lavc57.64.101 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/1300000 buffer size: 0 vbv_delay: -1
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[h264 @ 00000000006a9040] mmco: unref short failure
Last message repeated 1 times
[h264 @ 00000000006ac540] reference picture missing during reorder
[h264 @ 00000000006ac540] Missing reference picture, default is 65546
[h264 @ 00000000006ac540] reference picture missing during reorder
[h264 @ 00000000006ac540] Missing reference picture, default is 65546
[h264 @ 00000000006ac060] reference picture missing during reorder
[h264 @ 00000000006ac060] Missing reference picture, default is 65547
[h264 @ 00000000006ac060] reference picture missing during reorder
[h264 @ 00000000006ac060] Missing reference picture, default is 65547
[h264 @ 00000000006aad20] mmco: unref short failure
Last message repeated 1 times
frame= 300 fps=110 q=-1.0 Lsize= 1417kB time=00:00:09.90 bitrate=1171.4kbits/s speed=3.62x
video:1413kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.308107%
[libx264 @ 00000000006aca00] frame I:2 Avg QP:23.95 size: 24111
[libx264 @ 00000000006aca00] frame P:78 Avg QP:25.67 size: 9319
[libx264 @ 00000000006aca00] frame B:220 Avg QP:26.84 size: 3049
[libx264 @ 00000000006aca00] consecutive B-frames: 1.7% 1.3% 1.0% 96.0%
[libx264 @ 00000000006aca00] mb I I16..4: 68.2% 0.0% 31.8%
[libx264 @ 00000000006aca00] mb P I16..4: 42.7% 0.0% 0.0% P16..4: 35.2% 0.0% 0.0% 0.0% 0.0% skip:22.1%
[libx264 @ 00000000006aca00] mb B I16..4: 4.9% 0.0% 0.0% B16..8: 18.2% 0.0% 0.0% direct:17.2% skip:59.8% L0:43.8% L1:51.3% BI: 4.9%
[libx264 @ 00000000006aca00] final ratefactor: 23.59
[libx264 @ 00000000006aca00] direct mvs spatial:99.1% temporal:0.9%
[libx264 @ 00000000006aca00] coded y,uvDC,uvAC intra: 11.5% 59.6% 14.5% inter: 4.6% 30.5% 0.8%
[libx264 @ 00000000006aca00] i16 v,h,dc,p: 51% 29% 13% 7%
[libx264 @ 00000000006aca00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 17% 17% 10% 8% 6% 6% 8% 6%
[libx264 @ 00000000006aca00] i8c dc,h,v,p: 47% 24% 19% 10%
[libx264 @ 00000000006aca00] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 00000000006aca00] kb/s:1155.55
D:\>ffmpeg -y -i "D:\003.ts" -pass 2 -c:v libx264 -profile:v high -preset slow -b:v 1300k -an -vf "crop=1388:1056:257:24, scale=-1:720" -threads 4 -t 10 d:\episode_video.mp4
ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
libavutil 55. 34.101 / 55. 34.101
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.101 / 57. 56.101
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100
[h264 @ 0000000002608760] mmco: unref short failure
Last message repeated 1 times
[mpegts @ 00000000025e24a0] start time for stream 4 is not set in estimate_timings_from_pts
Input #0, mpegts, from 'D:\003.ts':
Duration: 00:29:00.13, start: 47722.528389, bitrate: 10930 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x101](por): Audio: aac_latm (HE-AAC) ([17][0][0][0] / 0x0011), 48000 Hz, stereo, fltp
Stream #0:2[0x102](por): Audio: aac_latm (HE-AAC) ([17][0][0][0] / 0x0011), 48000 Hz, stereo, fltp
Stream #0:3[0x103]: Data: bin_data ([6][0][0][0] / 0x0006)
Stream #0:4[0x104]: Data: bin_data ([6][0][0][0] / 0x0006)
[libx264 @ 00000000006fa860] using SAR=2603/2602
[libx264 @ 00000000006fa860] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 00000000006fa860] profile High, level 3.1
[libx264 @ 00000000006fa860] 264 - core 148 r2762 90a61ec - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=8 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=4 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=2pass mbtree=1 bitrate=1300 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 cplxblur=20.0 qblur=0.5 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'd:\video.mp4':
Metadata:
encoder : Lavf57.56.101
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 946x720 [SAR 5205:5203 DAR 347:264], q=-1--1, 1300 kb/s, 29.97 fps, 30k tbn, 29.97 tbc
Metadata:
encoder : Lavc57.64.101 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/1300000 buffer size: 0 vbv_delay: -1
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[h264 @ 00000000006fb200] mmco: unref short failure
Last message repeated 1 times
[h264 @ 00000000006fa380] reference picture missing during reorder
[h264 @ 00000000006fa380] Missing reference picture, default is 65546
[h264 @ 00000000006fa380] reference picture missing during reorder
[h264 @ 00000000006fa380] Missing reference picture, default is 65546
[h264 @ 00000000006f9ec0] reference picture missing during reorder
[h264 @ 00000000006f9ec0] Missing reference picture, default is 65547
[h264 @ 00000000006f9ec0] reference picture missing during reorder
[h264 @ 00000000006f9ec0] Missing reference picture, default is 65547
[h264 @ 00000000006f9520] mmco: unref short failure
Last message repeated 1 times
frame= 300 fps= 49 q=-1.0 Lsize= 1574kB time=00:00:09.90 bitrate=1300.9kbits/s speed=1.62x
video:1569kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.277527%
[libx264 @ 00000000006fa860] frame I:2 Avg QP:22.00 size: 26840
[libx264 @ 00000000006fa860] frame P:78 Avg QP:25.49 size: 10029
[libx264 @ 00000000006fa860] frame B:220 Avg QP:26.80 size: 3502
[libx264 @ 00000000006fa860] consecutive B-frames: 1.7% 1.3% 1.0% 96.0%
[libx264 @ 00000000006fa860] mb I I16..4: 35.2% 60.2% 4.6%
[libx264 @ 00000000006fa860] mb P I16..4: 17.5% 15.8% 0.7% P16..4: 40.0% 4.6% 4.5% 0.0% 0.0% skip:16.9%
[libx264 @ 00000000006fa860] mb B I16..4: 0.8% 1.5% 0.0% B16..8: 30.7% 2.4% 0.3% direct: 7.4% skip:56.9% L0:41.0% L1:56.4% BI: 2.7%
[libx264 @ 00000000006fa860] 8x8 transform intra:50.1% inter:90.7%
[libx264 @ 00000000006fa860] direct mvs spatial:100.0% temporal:0.0%
[libx264 @ 00000000006fa860] coded y,uvDC,uvAC intra: 27.4% 72.7% 22.4% inter: 6.5% 34.2% 0.9%
[libx264 @ 00000000006fa860] i16 v,h,dc,p: 37% 29% 11% 23%
[libx264 @ 00000000006fa860] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 9% 8% 14% 11% 13% 11% 12% 11% 12%
[libx264 @ 00000000006fa860] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 13% 8% 9% 17% 12% 13% 8% 10%
[libx264 @ 00000000006fa860] i8c dc,h,v,p: 25% 28% 17% 30%
[libx264 @ 00000000006fa860] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 00000000006fa860] ref P L0: 57.3% 15.9% 17.0% 4.5% 5.1% 0.1%
[libx264 @ 00000000006fa860] ref B L0: 81.6% 14.0% 3.3% 1.2%
[libx264 @ 00000000006fa860] ref B L1: 95.3% 4.7%
[libx264 @ 00000000006fa860] kb/s:1283.77