首页 > 解决方案 > How to increase speed of ffmpeg stream when running in cli assuming streaming over network

问题描述

I'd like to increase the speed of playback so that I can catch up to whatever the newest available audio packet is. Using PulseAudio on archlinux for server, client uses windows although that really shouldn't matter.

Server commands issued:

pactl load-module module-null-sink sink_name=remote
ffmpeg -f pulse -i "remote.monitor" -ac 2 -acodec pcm_s16le -ar 48000 -f s16le "udp://{LAN_IP_OF_CLIENT}:{PORT}"

Client command issued:

ffplay.exe -nodisp -ac 2 -acodec pcm_s16le -ar 48000 -analyzeduration 0 -probesize 32 -f u8 -i udp://0.0.0.0:{PORT}

Current setup is using pavucontrol to put the audio output to the pactl sink from firefox and just keeping the cli application running somewhere. Often times the network is slow, and the audio will grow an increasingly noticable lag behind whatever is onscreen. When I re-execute the commands on both server and client it catches up. If possible I'd like to keep up with whatever's being broadcast- I figure the simplest solution is to nudge the playback speed a little faster than audio is being sent over so that in the mid-long term it will fix itself.

If there's just a way to discard audio packets that aren't the newest ones and jump ahead when possible I'd prefer that as a solution- I know too little about ffmpeg to know if that's possible to do easily.

标签: ffmpegarchlinux

解决方案


不是一个理想的解决方案,但可以通过-filter:a "atempo:{speed_here}"标志提高速度。

https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video

仍然不知道如何从 cli 界面执行此操作。


推荐阅读