Open liyang142 opened 4 years ago
try: exec /usr/bin/ffmpeg -i rtmp://localhost/push/$name -f flv rtmp://localhost/live/$name
try: exec /usr/bin/ffmpeg -i rtmp://localhost/push/$name -f flv rtmp://localhost/live/$name
thank you for your reply but is not work
it can be releated with parameters,
exec /usr/bin/ffmpeg -i rtmp://localhost/push/$name -c copy -f flv rtmp://localhost/live/$name
normaly rtmp strusture is rtmp://IP_ADRESS:1935/aplication/endpoint in your case you have wrong endpoint this why it can't work . why sending input stream specify a name of your endpoint explicitly and then do
exec /usr/bin/ffmpeg -i rtmp://IP_ADRESS:1935/push/endpoint -c copy -f flv rtmp://IP_ADRESS:1935/live/new_endpoint
something litle bit complexe but very efficient is to write a php script or bash script to do it
and call exec php your_php_file_srcipt.php for example
in your nginx conf file
try :
user root;
worker_processes 1;
......
try :
user root;
worker_processes 1; ......
thank you for your reply but is not work
Are you running Nginx in a Docker container?
Confirm you can run ffmpeg with '/usr/bin/ffmpeg -codecs' Docker does not play well with localhost so just use the IP equivalent.
exec /usr/bin/ffmpeg -i rtmp://127.0.0.1/push/$name -f flv rtmp://127.0.0.1/live;
I can not solve this problem too....................
@liyang142 Did you solve this problem? I have the same problem with you?
通常rtmp的信任是rtmp:// IP_ADRESS:1935 / aplication / endpoint在你的情况下你有错误的端点,这就是为什么它不起作用的原因。为什么发送输入流显式指定端点的名称, 然后执行
exec /usr/bin/ffmpeg -i rtmp://IP_ADRESS:1935/push/endpoint -c copy -f flv rtmp://IP_ADRESS:1935/live/new_endpoint
有点复杂但非常有效的方法是编写一个php脚本或bash脚本来执行此操作, 然后调用
exec php your_php_file_srcipt.php for example
您的nginx conf文件
I tried the .sh file you mentioned, but the ffmpeg command is still not executed ffmpeg.sh: ffmpeg -re -i rtmp://ip:1936/myapp/$name -acodec copy -c:v libx264 -preset veryfast -profile:v baseline -vsync cfr -s 480x360 -b:v 400k -bufsize 400k -threads 0 -r 30 -f flv rtmp://ip:1936/myapp/test> /usr/local/erro/log.txt;
use script
exec_push /tmp/script.sh $name;
eval ffmpeg -i rtmp://localhost:port/$1
这个问题我也遇到了,是因为 nginx的 worker进程是没有指定用户的,所以找不到ffmepg这个东西
你可以参照官网 使用,打印出日志来看看就知道为什么了 application src { live on; exec_push ffmpeg -i rtmp://localhost/src/$name -vcodec libx264 -vprofile baseline -g 10 -s 300x200 -acodec aac -ar 44100 -ac 1 -f flv rtmp://localhost/hls/$name 2>>/var/log/ffmpeg-$name.log; }
application hls { live on; hls on; hls_path /tmp/hls; hls_fragment 15s; }
Generated by nginx-rtmp-module 1.1.4, nginx 1.18.0 use root run the nginx server
I use OBS for push streaming (rtmp://server/push); I use VLC player to play;
I want to achieve like "RTMP -> ffmpeg -> RTMP"
this is my nginx config;
the VLC url is rtmp://server/live; but can not play video;
i use the config. can print log,but the VLC not play video;
log file: