WWBN / AVideo-Encoder

Encoder Server for AVideo Platform Open-Source
https://platform.avideo.com
GNU Affero General Public License v3.0
152 stars 189 forks source link

I wanna change default encode flag libx264 to h264_qsv so it can use my graphics to help acceleration,but it doesn’t make sense #526

Open zhenniqi opened 10 months ago

zhenniqi commented 10 months ago

I wanna change default encode flag libx264 to h264_qsv so it can use my graphics to help acceleration,but it doesn’t make sense,I can’t find the reason , my h264_qsv flag is good to use directly in the termianal but can not be used in a video-encoder.Thanks.

DanielnetoDotCom commented 10 months ago

https://github.com/WWBN/AVideo-Encoder/wiki/Configuration.php-variable-(-some-are-hidden-)#using-gpu-for-ffmpeg

zhenniqi commented 10 months ago

Thank you,i try it and it does make sense,but i think it is an input option ,the output option is still -c:v libx264.And i found the output option is controlled by the line 583 in the /object/Format.php,i tried to change it to h264_qsv and failed,which i have no idea.

DanielnetoDotCom commented 10 months ago

image

Try to change it here

zhenniqi commented 10 months ago

Screenshot 2024-01-08 223324 ![Screenshot 2024-01-08 223432](https://github.com/WWBN/AVideo-Enco Screenshot 2024-01-08 223510 der/assets/78845723/0d5212ce-f950-4c26-b265-2975d69f68d2)

Yes,i tried to change all libx264 and h264 to h264_qsv but it still reamin unchange -c:v libx264.

DanielnetoDotCom commented 10 months ago

can you paste here a ffmpeg command from your encoder log?

zhenniqi commented 10 months ago

Yes,below is my log printed when i try to encode my videos. root@ziji-Surface-Pro-4:/var/www/html/AVideo/Encoder/videos# tail -n 0 -f avideo.log [08-Jan-2024 09:45:07 America/New_York] Upload.php will let function decide decideFormatOrder [08-Jan-2024 09:45:07 America/New_York] decideFormatOrder: {"file":"Watch Free Friends - Season 1 Movie Online HD - VHMovies_7.mp4","audioOnly":"false","spectrum":"false","webm":"false","override_status":"","videos_id":152,"update_video_id":0,"inputHLS":"false","inputLow":"false","inputSD":"false","inputHD":"false","inputAutoHLS":"false","inputAutoMP4":"true","inputAutoWebm":"false","inputAutoAudio":"false","title":"","description":"","categories_id":0,"releaseDate":"2024-01-07 20:31:00","timezone":"Asia\/Shanghai","PHPSESSID":"6kbt1b1nornua0mk871ple4h9v","notifyURL":""} [08-Jan-2024 09:45:07 America/New_York] decideFormatOrder: auto MP4 [08-Jan-2024 09:45:07 America/New_York] AVideo-Encoder Format::getFromOrder(7) [08-Jan-2024 09:45:07 America/New_York] Upload.php line: 113 "mp4" [08-Jan-2024 09:45:07 America/New_York] Encoder::sendFile videos_id=152, format=mp4 [08-Jan-2024 09:45:07 America/New_York] Encoder::sendFile sending file to aVideoEncoder.json from [08-Jan-2024 09:45:07 America/New_York] sendToStreamer to aVideoEncoder.json [08-Jan-2024 09:45:07 America/New_York] Encoder::save id=() title=(Watch Free Friends - Season 1 Movie Online HD - VHMovies_7) [08-Jan-2024 09:45:08 America/New_York] Encoder::save id=(80) title=(Watch Free Friends - Season 1 Movie Online HD - VHMovies_7) [08-Jan-2024 09:45:08 America/New_York] sendToStreamer spectrumimage not set [08-Jan-2024 09:45:08 America/New_York] sendToStreamer rawVideo not set [08-Jan-2024 09:45:08 America/New_York] sendToStreamer image not set [08-Jan-2024 09:45:08 America/New_York] sendToStreamer gifimage not set [08-Jan-2024 09:45:08 America/New_York] sendToStreamer webpimage not set [08-Jan-2024 09:45:08 America/New_York] sendToStreamer video not set [08-Jan-2024 09:45:08 America/New_York] sendToStreamer http://192.168.1.158/aVideoEncoder.json in 0.299 seconds {"error":false,"target":"aVideoEncoder.json","postFields":{"duration":"EE:EE:EE","title":"Watch Free Friends - Season 1 Movie Online HD - VHMovies_7","first_request":1,"categories_id":0,"format":"mp4","resolution":"","videoDownloadedLink":null,"description":"","downloadURL":"","chunkFile":"","encoderURL":"http:\/\/192.168.1.158\/Encoder\/","keepEncoding":"0","streamers_id":2,"user":"admin","pass":"_user_hash_LzBPZDZPTWRZYzBRbWhRYys5cjdlb1RQQkJFbUo3d1lEbGdOS0FUOVBPdDNiRitHR1JrQ0l6QkVMQjA0ZFpqNVBYUXZseXkwS0paRUw2NHZMNENhUnc9PQ==","return_vars":"{\"videos_id\":152,\"video_id_hash\":\"\",\"releaseDate\":\"2024-01-07 20:31:00\"}","releaseDate":"2024-01-07 20:31:00","releaseTime":1704677460,"videos_id":152,"timezone":"America\/New_York"},"response_raw":"{\"error\":false,\"video_id\":152,\"video_id_hash\":\"RzBnOUxNWDRrYmdXcllLRHU4aHd1YVhVckFCVmNnWFFhUWo5My91Qkg1QT0=\",\"releaseDate\":\"2024-01-07 20:31:00\",\"releaseTime\":\"1704677460\"}","response":{"error":false,"video_id":152,"video_id_hash":"RzBnOUxNWDRrYmdXcllLRHU4aHd1YVhVckFCVmNnWFFhUWo5My91Qkg1QT0=","releaseDate":"2024-01-07 20:31:00","releaseTime":"1704677460"}} [08-Jan-2024 09:45:08 America/New_York] Encoder::save id=(80) title=(Watch Free Friends - Season 1 Movie Online HD - VHMovies_7) [08-Jan-2024 09:45:09 America/New_York] getReturn_vars {"videos_id":152,"video_id_hash":"RzBnOUxNWDRrYmdXcllLRHU4aHd1YVhVckFCVmNnWFFhUWo5My91Qkg1QT0=","releaseDate":"2024-01-07 20:31:00"} [08-Jan-2024 09:45:09 America/New_York] Encoder::save id=(80) title=(Watch Free Friends - Season 1 Movie Online HD - VHMovies_7) [08-Jan-2024 09:45:09 America/New_York] Encoder::save id=(80) title=(Watch Free Friends - Season 1 Movie Online HD - VHMovies_7) [08-Jan-2024 09:45:09 America/New_York] downloadFile: start queue_id = 80 url = http://192.168.1.158/Encoder/videos/original_WatchFreeFriendsSeason1MovieOnlineHDVHMovies7_YPTuniqid_659c0a73af0598.09780824 pathFileName = /var/www/html/AVideo/Encoder/videos/80_tmpFile.mp4 [08-Jan-2024 09:45:09 America/New_York] downloadFile: not using getYoutubeDl [08-Jan-2024 09:45:09 America/New_York] downloadFile: this file was uploaded from file and thus is in the videos [08-Jan-2024 09:45:09 America/New_York] downloadFile: downloadedFile = /var/www/html/AVideo/Encoder/videos/original_WatchFreeFriendsSeason1MovieOnlineHDVHMovies7_YPTuniqid_659c0a73af0598.09780824 | url = http://192.168.1.158/Encoder/videos/original_WatchFreeFriendsSeason1MovieOnlineHDVHMovies7_YPTuniqid_659c0a73af0598.09780824 [08-Jan-2024 09:45:09 America/New_York] getVideoFile start(http://192.168.1.158/Encoder/videos/original_WatchFreeFriendsSeason1MovieOnlineHDVHMovies7_YPTuniqid_659c0a73af0598.09780824, 80, /var/www/html/AVideo/Encoder/videos/original_WatchFreeFriendsSeason1MovieOnlineHDVHMovies7_YPTuniqid_659c0a73af0598.09780824, /var/www/html/AVideo/Encoder/videos/80_tmpFile.mp4) [08-Jan-2024 09:45:09 America/New_York] getVideoFile done 71.72MB [08-Jan-2024 09:45:09 America/New_York] Encoder::save id=(80) title=(Watch Free Friends - Season 1 Movie Online HD - VHMovies_7) [08-Jan-2024 09:45:09 America/New_York] downloadFile: {"error":false,"filename":"80_tmpFile.mp4","pathFileName":"\/var\/www\/html\/AVideo\/Encoder\/videos\/80_tmpFile.mp4","msg":"We downloaded the file with success"} [08-Jan-2024 09:45:09 America/New_York] Original filesize is 71.72MB [08-Jan-2024 09:45:09 America/New_York] Encoder::save id=(80) title=(Watch Free Friends - Season 1 Movie Online HD - VHMovies_7) [08-Jan-2024 09:45:09 America/New_York] Encoder::save id=(80) title=(Watch Free Friends - Season 1 Movie Online HD - VHMovies_7) [08-Jan-2024 09:45:09 America/New_York] Duration found: 0:22:45 [08-Jan-2024 09:45:09 America/New_York] getImage: /usr/bin/ffmpeg -hwaccel qsv -ss 00:10:00 -i "/var/www/html/AVideo/Encoder/videos/80_tmpFile.mp4" -vframes 1 -y '/var/www/html/AVideo/Encoder/videos/80_tmpFile.mp4.jpg' [08-Jan-2024 09:45:09 America/New_York] getImage: takes 0.19532203674316 sec to complete [08-Jan-2024 09:45:10 America/New_York] getGif: takes 0.66860890388489 sec to complete [08-Jan-2024 09:45:12 America/New_York] getWebpImage: takes 1.3967390060425 sec to complete /var/www/html/AVideo/Encoder/videos/80_tmpFile.mp4.webp [08-Jan-2024 09:45:12 America/New_York] sendToStreamer to objects/aVideoEncoderReceiveImage.json.php [08-Jan-2024 09:45:12 America/New_York] Encoder::save id=(80) title=(Watch Free Friends - Season 1 Movie Online HD - VHMovies_7) [08-Jan-2024 09:45:12 America/New_York] Encoder::save id=(80) title=(Watch Free Friends - Season 1 Movie Online HD - VHMovies_7) [08-Jan-2024 09:45:12 America/New_York] sendToStreamer spectrumimage not set [08-Jan-2024 09:45:12 America/New_York] sendToStreamer rawVideo not set [08-Jan-2024 09:45:12 America/New_York] sendToStreamer video not set [08-Jan-2024 09:45:12 America/New_York] sendToStreamer http://192.168.1.158/objects/aVideoEncoderReceiveImage.json.php in 0.214 seconds {"error":false,"target":"objects\/aVideoEncoderReceiveImage.json.php","postFields":{"duration":"0:22:45","image":"13.16KB","downloadURL_image":"http:\/\/192.168.1.158\/Encoder\/videos\/80_tmpFile.mp4.jpg","gifimage":"854.60KB","downloadURL_gifimage":"http:\/\/192.168.1.158\/Encoder\/videos\/80_tmpFile.mp4.gif","webpimage":"296.60KB","downloadURL_webpimage":"http:\/\/192.168.1.158\/Encoder\/videos\/80_tmpFile.mp4.webp","streamers_id":"2","user":"admin","pass":"_user_hash_LzBPZDZPTWRZYzBRbWhRYys5cjdlb1RQQkJFbUo3d1lEbGdOS0FUOVBPdDNiRitHR1JrQ0l6QkVMQjA0ZFpqNVBYUXZseXkwS0paRUw2NHZMNENhUnc9PQ==","return_vars":"{\"videos_id\":152,\"video_id_hash\":\"RzBnOUxNWDRrYmdXcllLRHU4aHd1YVhVckFCVmNnWFFhUWo5My91Qkg1QT0=\",\"releaseDate\":\"2024-01-07 20:31:00\"}","releaseDate":"2024-01-07 20:31:00","releaseTime":1704677460,"videos_id":152,"video_id_hash":"RzBnOUxNWDRrYmdXcllLRHU4aHd1YVhVckFCVmNnWFFhUWo5My91Qkg1QT0=","timezone":"America\/New_York"},"response_raw":"{\"error\":false,\"video_id\":152,\"jpgDest\":\"\\/var\\/www\\/html\\/AVideo\\/videos\\/video_240108224454_vb530\\/video_240108224454_vb530.jpg\",\"jpgDestSize\":13480,\"gifDest\":\"\\/var\\/www\\/html\\/AVideo\\/videos\\/video_240108224454_vb530\\/video_240108224454_vb530.gif\",\"gifDestSize\":875107,\"webpDest\":\"\\/var\\/www\\/html\\/AVideo\\/videos\\/video_240108224454_vb530\\/video_240108224454_vb530.webp\",\"webpDestSize\":303720,\"jpgDest_deleteInvalidImage\":false,\"gifDest_deleteInvalidImage\":true,\"webpDest_deleteInvalidImage\":false,\"video_id_hash\":\"RzBnOUxNWDRrYmdXcllLRHU4aHd1YVhVckFCVmNnWFFhUWo5My91Qkg1QT0=\",\"releaseDate\":\"2024-01-07 20:31:00\",\"releaseTime\":\"1704677460\"}","response":{"error":false,"video_id":152,"jpgDest":"\/var\/www\/html\/AVideo\/videos\/video_240108224454_vb530\/video_240108224454_vb530.jpg","jpgDestSize":13480,"gifDest":"\/var\/www\/html\/AVideo\/videos\/video_240108224454_vb530\/video_240108224454_vb530.gif","gifDestSize":875107,"webpDest":"\/var\/www\/html\/AVideo\/videos\/video_240108224454_vb530\/video_240108224454_vb530.webp","webpDestSize":303720,"jpgDest_deleteInvalidImage":false,"gifDest_deleteInvalidImage":true,"webpDest_deleteInvalidImage":false,"video_id_hash":"RzBnOUxNWDRrYmdXcllLRHU4aHd1YVhVckFCVmNnWFFhUWo5My91Qkg1QT0=","releaseDate":"2024-01-07 20:31:00","releaseTime":"1704677460"}} [08-Jan-2024 09:45:12 America/New_York] AVideo-Encoder Format::run(/var/www/html/AVideo/Encoder/videos/80_tmpFile.mp4, 80) [08-Jan-2024 09:45:12 America/New_York] run (else): 7 [08-Jan-2024 09:45:12 America/New_York] AVideo-Encoder Format::getFromOrder(7) [08-Jan-2024 09:45:12 America/New_York] AVideo-Encoder Format::exec [31, /var/www/html/AVideo/Encoder/videos/80_tmpFile.mp4, /var/www/html/AVideo/Encoder/videos/avideoTmpFile_80_streamers_id2.mp4, 80] code=(-vf scale=-2:{$resolution} -movflags +faststart -preset veryfast -vcodec h264_qsv -acodec aac -b:a {$autioBitrate}k -max_muxing_queue_size 1024 -y {$destinationFile}) [08-Jan-2024 09:45:12 America/New_York] getResolution: /usr/bin/ffprobe -v quiet -print_format json -show_format -show_streams "/var/www/html/AVideo/Encoder/videos/80_tmpFile.mp4" [08-Jan-2024 09:45:13 America/New_York] getResolution: success 360 [08-Jan-2024 09:45:13 America/New_York] Encoder:Format:: getDynamicCommandFromFormat(/var/www/html/AVideo/Encoder/videos/80_tmpFile.mp4, 31) [resolutions=[1080,1440]] [height=360] [08-Jan-2024 09:45:13 America/New_York] Encoder:Format:: getDynamicCommandFromFormat resolution 1080 was ignored, your upload file is 360 we wil not up transcode your video [08-Jan-2024 09:45:13 America/New_York] Encoder:Format:: getDynamicCommandFromFormat::return(/usr/bin/ffmpeg -hwaccel qsv -i "{$pathFileName}" -c:v libx264 -movflags faststart -y /var/www/html/AVideo/Encoder/videos/avideoTmpFile_80_streamers_id_2_360.mp4 ) [08-Jan-2024 09:45:13 America/New_York] AVideo-Encoder Format::exec Start Encoder [/usr/bin/ffmpeg -hwaccel qsv -i "/var/www/html/AVideo/Encoder/videos/80_tmpFile.mp4" -c:v libx264 -movflags faststart -y /var/www/html/AVideo/Encoder/videos/avideoTmpFile_80_streamers_id_2_360.mp4 ] [08-Jan-2024 09:45:13 America/New_York] Encoder::save id=(80) title=(Watch Free Friends - Season 1 Movie Online HD - VHMovies_7)

DanielnetoDotCom commented 10 months ago

/usr/bin/ffmpeg -hwaccel qsv -i "/var/www/html/AVideo/Encoder/videos/80_tmpFile.mp4" -c:v libx264 -movflags faststart -y /var/www/html/AVideo/Encoder/videos/avideoTmpFile_80_streamers_id_2_360.mp4

Hi

as I can see you should change the 'Dynamic MP4' and it should work

zhenniqi commented 10 months ago

Thank you for your help,but i think i do change the dynamic mp4 and all other typec and save them before as the below pitcture shows.I also try to use control+f serach in my browser page and make sure there are no libx264 and h264 left. Screenshot 2024-01-08 230931

DanielnetoDotCom commented 10 months ago

Edit and change it. that is the line that is used to build the ffmpeg command