added input options to enable vaapi, override default bf value, add video filter
This commit is contained in:
		
							
								
								
									
										21
									
								
								main.js
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								main.js
									
									
									
									
									
								
							| @ -7,23 +7,30 @@ async function register ({ | |||||||
|     const builder = (options) => { |     const builder = (options) => { | ||||||
|       const { input, resolution, fps, streamNum } = options |       const { input, resolution, fps, streamNum } = options | ||||||
|  |  | ||||||
|       const streamString = streamNum ? ':' + streamNum : '' |  | ||||||
|  |  | ||||||
|       console.log(options); |  | ||||||
|       // You can also return a promise |       // You can also return a promise | ||||||
|       return { |       return { | ||||||
|         outputOptions: [ |         videoFilters: [ | ||||||
|  |           'hwupload' | ||||||
|  |         ], | ||||||
|  |         inputOptions: [ | ||||||
|           // enable hardware acceleration |           // enable hardware acceleration | ||||||
|           '-hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128' |           '-hwaccel vaapi', | ||||||
|  |           '-hwaccel_output_format vaapi', | ||||||
|  |           '-vaapi_device /dev/dri/renderD128' | ||||||
|  |         ], | ||||||
|  |         outputOptions: [ | ||||||
|  |           '-bf 8', // override hardcoded bf value which cause memory error | ||||||
|  |           '-pix_fmt vaapi_vld' | ||||||
|         ] |         ] | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     const encoder = 'libx264' |     const encoder = 'h264_vaapi' | ||||||
|     const profileName = 'foobarbaz' |     const profileName = 'vaapi' | ||||||
|  |  | ||||||
|     // Support this profile for VOD transcoding |     // Support this profile for VOD transcoding | ||||||
|     transcodingManager.addVODProfile(encoder, profileName, builder) |     transcodingManager.addVODProfile(encoder, profileName, builder) | ||||||
|  |     transcodingManager.addVODEncoderPriority('video', encoder, 1000) | ||||||
|  |  | ||||||
|     // And/Or support this profile for live transcoding |     // And/Or support this profile for live transcoding | ||||||
|     transcodingManager.addLiveProfile(encoder, profileName, builder) |     transcodingManager.addLiveProfile(encoder, profileName, builder) | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user