超声和病理的web实现方案 超声和病理的web实现方案

1. 整体思路

用推流的方式,从采集卡采集信息 -> ffmpeg -> nginx + rtmp -> 网页显示(现在需要flash插件,所以chrome版本不能太高)

2. 具体软件

Adobe Flash Player PPAPI for Chromium.7z
ChromePortable_9669.com.rar
ffmpeg.rar
nginx-rtmp-win32-master.rar

放在网盘ffmpeg目录下

3. 实现步骤

3.1 nginx需要有rtmp插件(百度一下)

3.2 nginx的配置文件:

worker_processes  1;

error_log  logs/error.log debug;

events {
    worker_connections  1024;
}

rtmp {
    server {
        listen 1935;

        application live {
            live on;
        }
		
        application hls {
            live on;
            hls on;  
            hls_path temp/hls;  
            hls_fragment 8s;  
        }
        
                chunk_size 4000;

        # TV mode: one publisher, many subscribers
        application wstv{

            # enable live streaming
            live on;

            # record first 1K of stream
            record all;
            record_path /tmp/av;
            record_max_size 1K;

            # append current timestamp to each flv
            record_unique on;

            # publish only from localhost
            allow publish 127.0.0.1;
            deny publish all;

            #allow play all;
        }
    }
}

http {
    server {
        listen      8080;
		
        location / {
            root html;
        }
		
        location /stat {
            rtmp_stat all;
            rtmp_stat_stylesheet stat.xsl;
        }

        location /stat.xsl {
            root html;
        }
		
        location /hls {  
            #server hls fragments  
            types{  
                application/vnd.apple.mpegurl m3u8;  
                video/mp2t ts;  
            }  
            alias temp/hls;  
            expires -1;  
        }  
    }
}

3.3 拷一个ws2.avi文件到ffmpeg.exe目录下,执行下列命令

ffmpeg -re -i ws2.avi -vcodec libx264 -acodec aac -f flv rtmp://localhost:1935/wstv/home

3.4 测试一下rtmp正常么

用vlc打开就可以看了
rtmp://localhost:1935/wstv/home

3.5 用chrome打开

http://localhost:8080/