kkroening / ffmpeg-python

Python bindings for FFmpeg - with complex filtering support
Apache License 2.0
9.99k stars 886 forks source link

ffmpeg terminal difference with ffmpeg in python #199

Open anonystick opened 5 years ago

anonystick commented 5 years ago

Hello! I need your help! I tried to understand but did not find a satisfactory answer. Please help me. When I use this command in the terminal, the stream image is the same as the prototype. But since I moved the command line to python, the stream quality is not as good as in the terminal. I tried to understand but did not find a satisfactory answer. Please help me.

terminal:

ffmpeg -f lavfi -i anullsrc -rtsp_transport tcp -i "rtsp:xxx.xxx" -tune zerolatency -vcodec libx264 -pix_fmt + -c:v copy -c:a aac -strict experimental -f flv "rtmp://xxxx"

in python.

command = ['ffmpeg',
    '-y',
    '-f', 'rawvideo',
    '-vcodec','rawvideo',
    '-pix_fmt', 'bgr24',
    '-s', '640x480',
    '-an',
    '-i', '-',
    '-c:v', 'libx264',
    '-pix_fmt', 'yuv420p',
    '-deinterlace',
    '-strict', 'experimental',
    '-r', '30',
    '-vb', '2000k',
    '-ab', '128k',
    '-ar', '22050',
    '-g', '60',
    '-preset', 'ultrafast',
    '-bufsize', '512k',
    '-f', 'flv',
    'rtmp://xxx']

Help me edit command in python the stream image is the same as the prototype. Thanks a lot!

kkroening commented 5 years ago

It would help if you could post the python code that generated that ffmpeg command.

kkroening commented 5 years ago

Er, I guess I'm confused as to what you're asking. The raw command-line and python snippet you posted look pretty different from one another.

I would recommend taking a closer look at the examples and see what you can piece together, and then ask more specific questions about what's confusing, rather than asking people to write your code for you.