Play online video transcoding video transcoding system online online

Online video transcoding system

Format on the network directly play video filming equipment is usually not our direct shooting such as (fmpeg, avi, rm, wov mkv, etc.). These file formats can not be online play directly on the network; in view before a customer needs an online direct upload to play this video this demand after any of the above video formats so that, after several studies I developed an energy-line direct upload and transcode online video playback system directly. The system provides API interface, when publishing content to upload any background video call interface back into the play address system background transcoding is complete;

The traditional way video transcoding

A call to the mainstream video site address

For example, I want to build a site, the site hopes to play a video, it is common practice to these mainstream video uploaded to video sites such as youku Tencent and other video sites and then let us re-embedded into web pages by their address so video playback way also can achieve the purpose; but they may add their logo branded advertising when your video playback;

Two local by transcoding software

Local by transcoding software to convert it to flv or mp4 video networks can play these formats and then uploaded by players this address; this fixes the problem, but it would be more trouble down the line to be processed manually;

Online video transcoding system

For example one of my clients in his news release system (CMS) prior to release news news video they usually are right or video on the outside of the video site youku, then Youku broadcast address; and later through our online revolution they put video coding system components by uploading a video to me our system interfaces directly to our system returns to the playback code without modifying any of the functions and code directly to the back of the player code into the news can be played;

  • Independent deployment does not affect existing systems;

  • It provides an interface for easy integration of existing legacy systems;

  • Support for distributed deployment

Interface documentation

(1) Upload video interface

POST /admin/Upload/upload

Upload video files, video files Note field for the file, type of file type;

parameter

parameter Types of Required Explanation
file file Yes Upload file field "file" field type is file
width number no Custom Player width; default 800
height number no Custom Player height; the default is 500
# 参考案例
curl -X POST \
  http://video-transcode.xxxx.net:81/admin/Upload/upload \
  -H 'cache-control: no-cache' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -F [email protected]

return value

# 注意上传放回的为原始视频,不要用这个地址类播放 这个视频很大;
# 上传成功后 携带 ID 回调请求 获取播放地址接口例如: /admin/play/15
{
    "status": 1,
    "info": "上传成功",
    "data": {
        "ext": "mpeg",
        "savename": "1.mpeg",
        "filename": "18b93553d62352efa0216b463a92ed63.mpeg",
        "size": "17M"
    },
    "upinfo": {
        "name": "1.mpeg",
        "type": "video/mpeg",
        "tmp_name": "/tmp/phpddldpC",
        "error": 0,
        "size": 18251036
    },
    "id": "20",
    "task_status": 1,
    "html": { # 播放器代码
        "iframe": "<iframe height=300 width=500 src=http://video-transcode2.xxx.net:81/api/Video/play?id=20></iframe>",
        "page": "http://video-transcode2.03in.net:81/api/Video/play?id=20"
    }
}

(2) to obtain the code to play video

GET /api/getplay/12

parameter

parameter Types of Explanation
id string Video ID, API directly coupled to the rear

On playing back video address description; upload video can not be played immediately; or because the transcoding process; need to wait to play video transcoding is complete, the length of time transcoding and video related to the size.

Examples

curl -X GET \
  http://video-transcode.xxxxx.net:81/api/getplay/12 \
  -H 'cache-control: no-cache' \
  

return

# 返回实例
{
    "info": "播放地址",
    "html": "<iframe height=400 width=510 src=http://video-transcode2.xxxx.net:81/api/Video/play?id=12></iframe>",
    "url": "http://video-transcode2.xxxx.net:81/api/Video/play?id=12>"
}

Guess you like

Origin www.cnblogs.com/freefei/p/11129993.html