AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / unix / 问题

问题[video-encoding](unix)

Martin Hope
John Tweed
Asked: 2022-10-01 02:12:01 +0800 CST

ffmpeg 用海水视频重新编码为 h625 文件大小翻倍

  • 0

我知道......已经有很多关于使用 ffmpeg 减小文件大小的问题。
但是,这就是为什么我的问题有点不同的原因,它解决了有困难的内容。我认为在我的源视频中移动海水的重要区域存在问题。
从手机上的 35MB 的 h624 视频中,我得到了 60MB 的“压缩”视频,其中

ffmpeg -i water.mp4 -vcodec libx265 -crf 28 small_water.mp4

一个更简单的例子也产生了更大的输出。

ffmpeg -i water.mp4 new_water.mp4

所以我的问题是,当视频包含大量快速移动的背景伪影时,你会怎么做?正常的方法似乎并没有减少尺寸,但我假设,一定有一些可行的方法。我想这与 F1 赛车视频的问题类似,视频在跟随汽车时在观众中平移。

背景; 我正在将几个电话视频转换为 h625 以缩小它们以在 Whatsapp 上发布,所有其他的都按预期缩小,除了“水”的尺寸翻了一番。所以更多出于兴趣以备将来参考,我想知道是否有解决方案。

ffmpeg video-encoding
  • 1 个回答
  • 25 Views
Martin Hope
LostXOR
Asked: 2021-10-31 09:15:51 +0800 CST

添加音频输入时,ffmpeg 录制速度变慢

  • 0

我正在尝试使用 ffmpeg 录制我的屏幕、麦克风和游戏音频。此命令仅记录我的屏幕。

ffmpeg \
-video_size 2560x1440 \
-framerate 60 \
-f x11grab -i :0 \
-map 0 \
-c:a copy \
-c:v libx264rgb \
-crf 0 \
-preset ultrafast \
video.mkv

它以稳定的 60 fps 记录,ffmpeg 给出输出

[x11grab @ 0x55717ef22dc0] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, x11grab, from ':0':
  Duration: N/A, start: 1635606965.195981, bitrate: N/A
    Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 2560x1440, 60 fps, 1000k tbr, 1000k tbn, 1000k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264rgb))
Press [q] to stop, [?] for help
[libx264rgb @ 0x55717ef30a40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264rgb @ 0x55717ef30a40] profile High 4:4:4 Predictive, level 5.1, 4:4:4 8-bit
[libx264rgb @ 0x55717ef30a40] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=0 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=18 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=cqp mbtree=0 qp=0
Output #0, matroska, to 'video.mkv':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (libx264rgb) (H264 / 0x34363248), bgr0, 2560x1440, q=-1--1, 60 fps, 1k tbn, 60 tbc
    Metadata:
      encoder         : Lavc58.54.100 libx264rgb
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame=  174 fps= 60 q=-1.0 Lsize=    3866kB time=00:00:02.91 bitrate=10854.0kbits/s dup=0 drop=1 speed=1.01x    

如果我尝试通过向命令添加输入来录制音频:

ffmpeg \
-video_size 2560x1440 \
-framerate 60 \
-f x11grab -i :0 \
-f pulse -i "alsa_output.usb-DeSheng_Electronics_Inc._XIBERIA-00.iec958-stereo.>
-f pulse -i "alsa_input.usb-DeSheng_Electronics_Inc._XIBERIA-00.mono-fallback" \
-map 0 -map 1 -map 2 \
-c:a copy \
-c:v libx264rgb \
-crf 0 \
-preset ultrafast \
video.mkv

ffmpeg 给出输出

[x11grab @ 0x55bf9b4e80c0] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, x11grab, from ':0':
  Duration: N/A, start: 1635606747.731781, bitrate: N/A
    Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 2560x1440, 60 fps, 1000k tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, pulse, from 'alsa_output.usb-DeSheng_Electronics_Inc._XIBERIA-00.iec958-stereo.monitor':
  Duration: N/A, start: 1635606747.770507, bitrate: 1536 kb/s
    Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Guessed Channel Layout for Input Stream #2.0 : stereo
Input #2, pulse, from 'alsa_input.usb-DeSheng_Electronics_Inc._XIBERIA-00.mono-fallback':
  Duration: N/A, start: 1635606747.811649, bitrate: 1536 kb/s
    Stream #2:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264rgb))
  Stream #1:0 -> #0:1 (copy)
  Stream #2:0 -> #0:2 (copy)
Press [q] to stop, [?] for help
[libx264rgb @ 0x55bf9b519d80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264rgb @ 0x55bf9b519d80] profile High 4:4:4 Predictive, level 5.1, 4:4:4 8-bit
[libx264rgb @ 0x55bf9b519d80] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=0 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=18 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=cqp mbtree=0 qp=0
Output #0, matroska, to 'video.mkv':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (libx264rgb) (H264 / 0x34363248), bgr0, 2560x1440, q=-1--1, 60 fps, 1k tbn, 60 tbc
    Metadata:
      encoder         : Lavc58.54.100 libx264rgb
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
    Stream #0:2: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
[pulse @ 0x55bf9b4f4000] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[matroska @ 0x55bf9b518280] Non-monotonous DTS in output stream 0:1; previous: 364, current: 358; changing to 364. This may result in incorrect timestamps in the output file.
frame=   21 fps=0.0 q=0.0 size=       1kB time=00:00:01.01 bitrate=   7.7kbits/sframe=   21 fps= 21 q=0.0 size=       1kB time=00:00:01.01 bitrate=   7.7kbits/s
[matroska @ 0x55bf9b518280] Non-monotonous DTS in output stream 0:1; previous: 843, current: 838; changing to 843. This may result in incorrect timestamps in the output file.
[x11grab @ 0x55bf9b4e80c0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)

并以 20 fps 的速度记录,同时每隔几秒打印一次“非单调 DTS”和“线程消息队列阻塞”消息。我假设音频以某种方式减慢了视频录制速度,我该如何解决?

ffmpeg video-encoding
  • 1 个回答
  • 172 Views
Martin Hope
user2661923
Asked: 2019-03-25 15:40:11 +0800 CST

加速视频转换

  • -1

我喜欢在将大型视频文件存储到硬盘之前对其进行压缩。在 Fedora-29-bash 中,我目前使用以下 ffmpeg 命令进行重新编码;它平衡了压缩和质量:

ffmpeg -i $in_path -b:v 960k -bufsize 9600k -strict -2 $out_path

对运行时间为 30 分钟的 2gb 视频文件执行上述命令时,执行时间约为 20 分钟。我的硬件显示在此查询的末尾。 可以加快此视频重新编码的速度吗?

换句话说,如果我放弃 ffmpeg 转而使用任何其他软件(例如手刹),我会获得更快的重新编码吗?根据我通过 bash(例如 cp 或 rsync 命令)与使用(nemo)文件管理器复制文件的经验,我的直觉是没有什么能比 bash-ffmpeg 性能更好。

我提交此查询只是为了仔细检查我的直觉。

我的硬件

os         :  64 bit fedora 29
cpu        :  Intel I5-4440 Processor BX80646I54440
mobo       :  (64 bit) Gigabyte H97 SATA Express M.2 SSD UEFI DualBIOS  
           :  DDR3 1600 LGA
memory     :  32 gb : 2 x [G.Skill F3-1600C10D-16GAO Ares 16GB (2x8GB) 
           :  DDR3-1600Mhz Memory RAM]
psu        :  corsair cx series 600 watt
hdisk      :  1tb internal western digital wd10ezex sata
video card :  none - I use mobo's onboard video at 1920x1080.
sound card :  none - I use mobo's onboard audio
ffmpeg video-encoding
  • 1 个回答
  • 69 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve