gpt4 book ai didi

video - 使用 libx264 的 ffmpeg 转换看起来很糟糕 - 隔行扫描

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

我正在将一些文件从我的机顶盒 (.ASF) 格式转换为更便携的文件,以便更容易地与 plex 和 roku 一起使用。在这样做时,我正在使用 ffmpeg ,但结果不尽人意。虽然原始文件没有任何明显的隔行扫描缺陷,但转换后的文件却有。由于以下实验,我认为它与 libx264 转换器有关:

运行此命令:

ffmpeg -i file.asf -vcodec copy -acodec copy -bsf:a aac_adtstoasc -ss 150 -t 15 short.mp4

ffmpeg version 3.0.2 Copyright (c) 2000-2016 the FFmpeg developers
built with Apple LLVM version 7.3.0 (clang-703.0.29)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.0.2 --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 --enable-vda
libavutil 55. 17.103 / 55. 17.103
libavcodec 57. 24.102 / 57. 24.102
libavformat 57. 25.100 / 57. 25.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 31.100 / 6. 31.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
[asf @ 0x7f9f84000000] Could not find codec parameters for stream 2 (Unknown: none): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, asf, from 'file.asf':
Metadata:
title : Slingbox
artist : Sling Media
comment : test
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (High) (h264 / 0x34363268), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 30.30 fps, 30 tbr, 1k tbn, 59.94 tbc
Stream #0:1: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 32000 Hz, stereo, fltp, 96 kb/s
Stream #0:2: Unknown: none
File 'short.mp4' already exists. Overwrite ? [y/N] y
Output #0, mp4, to 'short.mp4':
Metadata:
title : Slingbox
artist : Sling Media
comment : test
encoder : Lavf57.25.100
Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 30.30 fps, 30 tbr, 16k tbn, 1k tbc
Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 32000 Hz, stereo, 96 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x7f9f8388c200] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[mp4 @ 0x7f9f8388c200] pts has no value
Last message repeated 449 times
frame= 450 fps=0.0 q=-1.0 Lsize= 9002kB time=00:00:15.02 bitrate=4907.9kbits/s speed=92.1x
video:8817kB audio:173kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.125406%

这会产生一个没有隔行扫描伪影的文件,并且看起来与原始文件大小完全相同(如果在没有 -ss 和 -t 命令的情况下运行)。

但是运行这个命令(没有任何选项):

ffmpeg -i test.asf -ss 150 -t 15 short2.mp4
ffmpeg version 3.0.2 Copyright (c) 2000-2016 the FFmpeg developers
built with Apple LLVM version 7.3.0 (clang-703.0.29)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.0.2 --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 --enable-vda
libavutil 55. 17.103 / 55. 17.103
libavcodec 57. 24.102 / 57. 24.102
libavformat 57. 25.100 / 57. 25.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 31.100 / 6. 31.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
[asf @ 0x7fec32801400] Could not find codec parameters for stream 2 (Unknown: none): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, asf, from 'test.asf':
Metadata:
title : Slingbox
artist : Sling Media
comment : test
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (High) (h264 / 0x34363268), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 30.30 fps, 30 tbr, 1k tbn, 59.94 tbc
Stream #0:1: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 32000 Hz, stereo, fltp, 96 kb/s
Stream #0:2: Unknown: none
[libx264 @ 0x7fec32102800] using SAR=1/1
[libx264 @ 0x7fec32102800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x7fec32102800] profile High, level 4.0
[libx264 @ 0x7fec32102800] 264 - core 148 r2668 fd2c324 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 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=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'short2.mp4':
Metadata:
title : Slingbox
artist : Sling Media
comment : test
encoder : Lavf57.25.100
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 30 fps, 15360 tbn, 30 tbc
Metadata:
encoder : Lavc57.24.102 libx264
Side data:
unknown side data type 10 (24 bytes)
Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 32000 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc57.24.102 aac
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame= 450 fps= 20 q=-1.0 Lsize= 6732kB time=00:00:15.00 bitrate=3674.9kbits/s speed=0.657x
video:6481kB audio:240kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.168370%
[libx264 @ 0x7fec32102800] frame I:12 Avg QP:18.85 size: 39804
[libx264 @ 0x7fec32102800] frame P:291 Avg QP:21.40 size: 17543
[libx264 @ 0x7fec32102800] frame B:147 Avg QP:22.61 size: 7167
[libx264 @ 0x7fec32102800] consecutive B-frames: 42.9% 36.9% 11.3% 8.9%
[libx264 @ 0x7fec32102800] mb I I16..4: 43.2% 52.0% 4.8%
[libx264 @ 0x7fec32102800] mb P I16..4: 11.9% 16.0% 1.0% P16..4: 30.2% 3.0% 1.7% 0.0% 0.0% skip:36.2%
[libx264 @ 0x7fec32102800] mb B I16..4: 0.6% 0.9% 0.1% B16..8: 25.7% 1.4% 0.2% direct: 4.6% skip:66.6% L0:49.0% L1:49.4% BI: 1.6%
[libx264 @ 0x7fec32102800] 8x8 transform intra:55.1% inter:92.0%
[libx264 @ 0x7fec32102800] coded y,uvDC,uvAC intra: 22.5% 38.6% 6.6% inter: 6.5% 17.3% 0.5%
[libx264 @ 0x7fec32102800] i16 v,h,dc,p: 28% 47% 8% 17%
[libx264 @ 0x7fec32102800] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34% 15% 42% 1% 1% 2% 1% 2% 1%
[libx264 @ 0x7fec32102800] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 78% 6% 1% 1% 1% 1% 1% 1%
[libx264 @ 0x7fec32102800] i8c dc,h,v,p: 59% 19% 19% 3%
[libx264 @ 0x7fec32102800] Weighted P-Frames: Y:14.4% UV:3.8%
[libx264 @ 0x7fec32102800] ref P L0: 65.5% 6.6% 19.0% 8.4% 0.4%
[libx264 @ 0x7fec32102800] ref B L0: 89.6% 8.9% 1.5%
[libx264 @ 0x7fec32102800] ref B L1: 98.6% 1.4%
[libx264 @ 0x7fec32102800] kb/s:3539.34
[aac @ 0x7fec32103a00] Qavg: 573.580

通过 Plex 通过 Roku 在我的高清投影仪上播放时产生的文件有相当多的隔行扫描缺陷(启用直接播放,显然没有转码)。

still frame from second transcode showing visual defect

免得我太挑剔了,我让我妻子参与了这个测试,给她看了两个文件,她同意那个使用 libx264 的文件。明显更糟,无法观看。无法弄清楚如何在不导致这些交错缺陷的情况下缩小此文件 - 即使我不尝试缩小它也会发生!有什么想法吗?

视频文件:

https://dl.dropboxusercontent.com/u/23091/m1/short.mp4
https://dl.dropboxusercontent.com/u/23091/m1/short2.mp4

更新:此外,我尝试了一些设置来生成 MPEG4 (.AVI) 文件,但同样没有成功。类似的交错缺陷。

最佳答案

源视频是隔行扫描的,所以需要去隔行扫描。

在 FFmpeg 中使用的标准过滤器是 YADIF。

所以,基本语法是

ffmpeg -i file.asf -vf yadif -c:a copy -bsf:a aac_adtstoasc file.mp4 

关于video - 使用 libx264 的 ffmpeg 转换看起来很糟糕 - 隔行扫描,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37848536/

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