I am trying to use ffmpeg to downscale a video and pipe the stdout data to ffplay to play the new downsized video by piping it to ffplay on aws lambda.
This is the command I have so far, but for some reason adding a scale option is not working.
I am trying to run this command locally before I deploy it on python with subprocess command. I need the raw video to be able to save into database for streaming the data in realtime.
%ffmpeg -i sample.mp4 -vf scale=240:-2 -f mpegts -c:v copy -af aresample=async=1:first_pts=0 - | ffplay -
adding the scale optioin for some reason is saving the video as the name scale=240:-2 which does not make sense.
This command makes it so that you can convert it in memory rather than saving the video to a local storage as mp4. You can remove the -movflags if you are formatting it as mpegts, but in the case of mp4 you need fragmented flag.
"ffmpeg " \
"-i "+str(video_path)+" " \
"-filter:v scale="+str(width)+":"+str(height)+" " \
"-movflags frag_keyframe+empty_moov " \
"-f mp4 " \
"-af aresample=async=1:first_pts=0 " \
"-"