Closed sincez closed 3 years ago
截图中画了红线的是 nginx-http-flv-module 用exec_pull 拉起的 ffmpeg 命令,上面个命令是原始的 ffmpeg 推流命令,推到端口 1935(默认),拉起的 ffmpeg 从 1935 端口拉流后,再推到端口 1995,配置如下:
exec_pull bash -c " ffmpeg -re -i rtmp://localhost/myapp/mystream -vcodec libx264 -vprofile baseline -f flv rtmp://localhost:1995/$app/$name;"
我没有 rtsp 流地址,所以就用了 rtmp 流做的测试,除此之外,跟你的配置没什么区别,请保证你的原始 rtsp 流和配置都没问题。
我在本地测试exec_pull拉流,发现一直无法成功,不知道什么原因,日志提示,exec命令终止,但是不清除什么原因终止的 exec_pull执行的命令:
exec_pull bash -c "ffmpeg -re -rtsp_transport tcp -i rtsp://127.0.0.1:554/openUrl/RGLNHig -vcodec libx264 -vprofile baseline -f flv rtmp://127.0.0.1:1935/live/test;";
日志内容:2021/03/07 10:38:06 [debug] 7#7: timer delta: 1285 2021/03/07 10:38:06 [debug] 7#7: event timer del: 1771266144: 8916520 2021/03/07 10:38:06 [info] 7#7: exec: starting managed child 'bash' 2021/03/07 10:38:06 [debug] 7#7: epoll add event: fd:14 op:1 ev:00002001 2021/03/07 10:38:06 [debug] 7#7: exec: child 'bash' started pid=16 2021/03/07 10:38:06 [debug] 7#7: worker cycle 2021/03/07 10:38:06 [debug] 7#7: epoll timer: 3545 2021/03/07 10:38:06 [debug] 7#7: epoll: fd:14 ev:0010 d:00007FC969936108 2021/03/07 10:38:06 [notice] 7#7: signal 17 (SIGCHLD) received from 16 2021/03/07 10:38:06 [notice] 7#7: unknown process 16 exited with code 1 2021/03/07 10:38:06 [debug] 7#7: shmtx forced unlock 2021/03/07 10:38:06 [debug] 7#7: epoll_wait() error on fd:14 ev:0010 2021/03/07 10:38:06 [info] 7#7: exec: child 16 exited; ignoring 2021/03/07 10:38:06 [debug] 7#7: epoll del event: fd:14 op:2 ev:00000000 2021/03/07 10:38:06 [info] 7#7: exec: terminating child 16 2021/03/07 10:38:06 [debug] 7#7: exec: schedule respawn 5000msec 2021/03/07 10:38:06 [debug] 7#7: event timer add: 1771266144: 5000:8921824 2021/03/07 10:38:06 [debug] 7#7: timer delta: 237 2021/03/07 10:38:06 [debug] 7#7: worker cycle 2021/03/07 10:38:06 [debug] 7#7: epoll timer: 3308