EFV framework: FluentAPI and CMS API2 services, modular building blocks, 6 FLUENTAPI endpoints and the full CMS API2
As previously announced, EFV is being redesigned into two architectural parts. FLuentAPI offers video-processing API services, called internally or by any program anywhere. CMS API2 offers complete content-related API services: sign-in, registration, video queries, playback, popular content, VIP purchases, point purchases and payments. Calling them from a CMS or APP is simple; anyone can build any frontend or APP with this API set without restrictions.
Architecture

Updates
- One: Completed the full
CMS APIfor content, already used to build a complete commercially usableAPPinflutter. - Two: Completed the commercial
flutterAPPsource, now in final testing. Intelligent recommendations andCMS API2deliver native60to120frame smoothness beyondweexorh5implementations. - Three: Completed
6Flent APIendpoints. ThisAPIset providesAPIoperations to generate single screenshots, screenshot batches, animations and previewm3u8; assemble serverm3u8intomp4in real time; and retrieve videometadata. - Four: Dynamic screenshots, preview
m3u8generation and real-time animations throughFLUENTapinow support third-partym3u8, including route-permission-level previews ofm3u8.
Fluent API
Here are the completed Fluent API endpoints. Future API services include remote transcoding, adding watermarks, removal templates and scrolling text.
Note: Every API below works with server-side video files and remote video URLs.
Generate a single screenshot
post: /apifluent/screenshot
body: {
apikey,
apisecret,
path, // 支持服务器视频文件绝对路径,服务器视频相对路径,服务器源码目录相对路径,远程m3u8连接,远程视频文件链接等。
duration, // 需要截图视频什么时间的画面,单位是秒。
}
response: {
success: 0|1, // 成功或者失败
error, // 如果失败会返回错误信息。
screenshot, // 截图的链接。
}
Supported path formats: "/path/2.m3u8", "./public/videos/3.mp4", "public/videos/4.m3u8", "https://www.leimulamu.com/videos/202006/12/5ed37e23d6334d5540c43b00/d1052c/index.m3u8",
"https://www.moemv.com/videos/6.mp4"
All following API endpoints with a path parameter support the same formats.
Generate multiple screenshots
post: /apifluent/screenshots
body: {
apikey,
apisecret,
path,
counts //截图数量,会根据视频时间轴,均分截取,比如10秒视频,设置counts为3,则可能截图3,6,9秒的画面。
}
response: {
success: 0|1,
error, //如果有错误信息会返回错误信息。
screenshots, //数组,包含所有截图链接。
}
Generate an animated image
post: /apifluent/togif
data: {
apikey,
apisecret,
path, //必填,下面的参数选填。
duration, // 生成多少秒动态图,默认1秒
width, //动态图宽度,高度自适应, 默认400宽度
gifstart, // 从视频多少秒开始生成, 默认10秒
auto //是否自动截取视频最中间位置,接收1或0,设置了auto,则gifstart是否设置都无效,默认是0。
}
response: {
success: 0|1,
error,
gif //动态图链接
}
Retrieve video metadata
post: /apifluent/metadata
body: {
apikey,
apisecret,
path
}
response: {
success: 1|0,
error,
data // 视频的各种信息,包括音频流,视频流等。
}
data样式:
{
"success": 1,
"data": {
"streams": [
{
"index": 0,
"codec_name": "h264",
"codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
"profile": "High",
"codec_type": "video",
"codec_time_base": "1/48",
"codec_tag_string": "avc1",
"codec_tag": "0x31637661",
"width": 854,
"height": 480,
"coded_width": 864,
"coded_height": 480,
"has_b_frames": 2,
"sample_aspect_ratio": "N/A",
"display_aspect_ratio": "N/A",
"pix_fmt": "yuv420p",
"level": 30,
"color_range": "unknown",
"color_space": "unknown",
"color_transfer": "unknown",
"color_primaries": "unknown",
"chroma_location": "left",
"field_order": "unknown",
"timecode": "N/A",
"refs": 1,
"is_avc": "true",
"nal_length_size": 4,
"id": "N/A",
"r_frame_rate": "24/1",
"avg_frame_rate": "24/1",
"time_base": "1/24",
"start_pts": 0,
"start_time": 0,
"duration_ts": 1253,
"duration": 52.208333,
"bit_rate": 537875,
"max_bit_rate": "N/A",
"bits_per_raw_sample": 8,
"nb_frames": 1253,
"nb_read_frames": "N/A",
"nb_read_packets": "N/A",
"tags": {
"creation_time": "1970-01-01T00:00:00.000000Z",
"language": "und",
"handler_name": "VideoHandler"
},
"disposition": {
"default": 1,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0,
"timed_thumbnails": 0
}
},
{
"index": 1,
"codec_name": "aac",
"codec_long_name": "AAC (Advanced Audio Coding)",
"profile": "LC",
"codec_type": "audio",
"codec_time_base": "1/48000",
"codec_tag_string": "mp4a",
"codec_tag": "0x6134706d",
"sample_fmt": "fltp",
"sample_rate": 48000,
"channels": 2,
"channel_layout": "stereo",
"bits_per_sample": 0,
"id": "N/A",
"r_frame_rate": "0/0",
"avg_frame_rate": "0/0",
"time_base": "1/48000",
"start_pts": 0,
"start_time": 0,
"duration_ts": 2493440,
"duration": 51.946667,
"bit_rate": 126694,
"max_bit_rate": 128000,
"bits_per_raw_sample": "N/A",
"nb_frames": 2435,
"nb_read_frames": "N/A",
"nb_read_packets": "N/A",
"tags": {
"creation_time": "1970-01-01T00:00:00.000000Z",
"language": "und",
"handler_name": "SoundHandler"
},
"disposition": {
"default": 1,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0,
"timed_thumbnails": 0
}
}
],
"format": {
"filename": "https://media.w3.org/2010/05/sintel/trailer.mp4",
"nb_streams": 2,
"nb_programs": 0,
"format_name": "mov,mp4,m4a,3gp,3g2,mj2",
"format_long_name": "QuickTime / MOV",
"start_time": 0,
"duration": 52.209,
"size": 4372373,
"bit_rate": 669979,
"probe_score": 100,
"tags": {
"major_brand": "isom",
"minor_version": "512",
"compatible_brands": "isomiso2avc1mp41",
"creation_time": "1970-01-01T00:00:00.000000Z",
"title": "Sintel Trailer",
"artist": "Durian Open Movie Team",
"encoder": "Lavf52.62.0",
"copyright": "(c) copyright Blender Foundation | durian.blender.org",
"description": "Trailer for the Sintel open movie project"
}
},
"chapters": []
}
}
Retrieve preview m3u8 text
GET /apifluent/try
headers: {
apikey,
apisecret,
}
query: {
id:视频ID,
duration:试看时长,
hd:指定分辨率,
}
response: m3u8文本 //获取到文本可自行组装自己的m3u8路由。
Generate mp4 in real time by video id and resolution
post: /apifluent/savestream
data: {
apikey,
apisecret,
id, //视频库中存在的转码完成的id,
hd //指定生成某分辨率,支持240,360,480,640,720,1080,1440,20000
}
response: {
success: 1|0,
host, // 服务端域名
path, // mp4链接
message // 显示信息
}
此API可用于提供下载功能时,无需保存mp4,完全实时根据m3u8生成mp4文件,并且返回,秒级反馈。


