It's not possible to filter stream and copy it, but in this case I copy video and filter audio. Solution:
ffmpeg -i v -i m -filter_complex amix=duration=shortest -vcodec copy -shortest -y out_v
Question
I need to implement two features:
Solution for 1:
ffmpeg -i music_url -i video_url -codec copy -y -shortest output_video
Solution for 2:
ffmpeg -i video_url -i music_url -filter_complex amix=duration=shortest -y output_video
But there are a few problems with 2nd:
Any hints?
EDIT:
ffmpeg -i vid -i music -filter_complex amix=duration=shortest -shortest -y out_v
Seems it's not possible to stream copy video and filter audio. Need to figure out how to keep the video with the same quality, because the default behaviour lowers it.
Solution
It's not possible to filter stream and copy it, but in this case I copy video and filter audio. Solution:
ffmpeg -i v -i m -filter_complex amix=duration=shortest -vcodec copy -shortest -y out_v