%20-vf%2F-af%2F-filter%20%EB%B0%8F%20-filter_complex%EB%8A%94%20%EB%8F%99%EC%9D%BC%ED%95%9C%20%EC%8A%A4%ED%8A%B8%EB%A6%BC%EC%97%90%20%ED%95%A8%EA%BB%98%20%EC%82%AC%EC%9A%A9%ED%95%A0%20%EC%88%98%20%EC%97%86%EC%8A%B5%EB%8B%88%EB%8B%A4..png)
화면 비디오와 두 개의 오디오 스트림(마이크에서 하나, 아날로그 모니터에서 하나)을 캡처하려고 합니다.
ffmpeg -video_size "$__screen_size__" \
-framerate 50 \
-thread_queue_size 512 -f x11grab -i :0.0+0,0 \
-thread_queue_size 512 -f pulse -i "$__input_mic__" \
-thread_queue_size 512 -f pulse -i "$__output_monitor__" \
-filter_complex amerge \
-ac 2 \
-vcodec libx264rgb -crf 0 -preset:v ultrafast \
-acodec pcm_s16le \
-af aresample=async=1:first_pts=0 \
-async 1 \
-y \
"$__output__"
문제는 ffmpeg가 하나의 스트림에서 동시에 두 개의 필터를 사용하는 것에 대해 불평한다는 것입니다.
Filtergraph 'aresample=async=1:first_pts=0' was specified through the
-vf/-af/-filter option for output stream 0:0, which is fed from a complex filtergraph.
-vf/-af/-filter and -filter_complex cannot be used together for the same stream.
그러나 아래 스크립트(마이크를 구성하는 오디오 스트림이 하나만 있음)는 오디오 스트림을 병합할 필요가 없을 때 제대로 작동합니다.
ffmpeg -video_size "$__screen_size__" \
-framerate 50 \
-thread_queue_size 512 -f x11grab -i :0.0+0,0 \
-thread_queue_size 512 -f pulse -i "$__input_mic__" \
-vcodec libx264rgb -crf 0 -preset:v ultrafast \
-acodec pcm_s16le \
-af aresample=async=1:first_pts=0 \
-async 1 \
-y \
"$__output__"
기본적으로 다음을 제거합니다.
-thread_queue_size 512 -f pulse -i "$__output_monitor__" \
-filter_complex amerge \
-ac 2 \
위 항목을 제거 -af aresample=async=1:first_pts=0
하고 유지하면 오디오와 비디오가 동기화되지 않습니다.
기본적으로 지연 없이 오디오 스트림을 병합하고 싶습니다.
답변1
단일 필터 그래프에 모든 필터를 지정해야 합니다.
-filter_complex [1]aresample=async=1:first_pts=0[a];[2]aresample=async=1:first_pts=0[b];[a][b]amerge