Luke 37113 Posted February 15, 2017 Share Posted February 15, 2017 Thanks for the info. Link to comment Share on other sites More sharing options...
libnc 0 Posted February 16, 2017 Share Posted February 16, 2017 (edited) So asuning this info we can use : filter part: "format=nv12|vaapi,hwupload,scale_vaapi=w=1280:h=720" to resize livestream and line of encapsulating became : -fflags +genpts -fpsprobesize 200 -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -i "input_live_stream" -vf "$filtro" -c:v h264_vaapi -qp 25 -c:a aac -f flv..."output_rtmp_local_media" on this way can obtain a best quality but compression above 25% less -quality -in my case can be 0 (default) -i suppose al core ad asuming max values as 2 ..i supose acting on the same way as value"0" ' so the best way untill now is : "-i {INPUT} -c:v h264_vaapi -qp 25 -c:a aac -f {OUTPUT}.." maybe need some adjustments here ? Edited February 16, 2017 by libnc Link to comment Share on other sites More sharing options...
Luke 37113 Posted February 16, 2017 Share Posted February 16, 2017 Does it have any kind of max-height param, rather than fixed height? Link to comment Share on other sites More sharing options...
Andy777 21 Posted February 16, 2017 Share Posted February 16, 2017 Does it have any kind of max-height param, rather than fixed height? I don't think that the current release version of ffmpeg supports anything but fixed h and w, but expressions are coming and already supported by the master branch: https://github.com/FFmpeg/FFmpeg/commit/037bb4021c0b0b33c752850f58cf7e2ea44359b7 Link to comment Share on other sites More sharing options...
Luke 37113 Posted February 16, 2017 Share Posted February 16, 2017 Cool, that will be nice. Link to comment Share on other sites More sharing options...
Andy777 21 Posted February 16, 2017 Share Posted February 16, 2017 so the best way untill now is : "-i {INPUT} -c:v h264_vaapi -qp 25 -c:a aac -f {OUTPUT}.." Yes. You get better quality when using -qp instead of bitrate, but your video bitrate will depend on many things like frame size and frame rate etc... In streaming media one usually want's to know (and control) the resulting bitrate. Link to comment Share on other sites More sharing options...
Andy777 21 Posted February 16, 2017 Share Posted February 16, 2017 There is not currently much to do. Vaapi sucks on low bitrates. Good news: Quality improvements are coming eventually at least for Intel SKL+ and APL+. See this https://github.com/01org/intel-vaapi-driver/pull/33. Bad news 1: It will take very long time until these end up in any supported distributions. Bad news 2: On some platforms (but mostly limited to h.265) HuC firmware is required, which most likely also requires a new kernel. Link to comment Share on other sites More sharing options...
libnc 0 Posted February 16, 2017 Share Posted February 16, 2017 Input stream have 25 fps so output need to be the same, here is nothing to modiffy in my case. For me, as i use a dual core proc, really i neeed to run most of process in GPU, like resize ,forrmat of colour. The problem is to reduce distorction on immage when movements becoms accelerated. Other i run 4 process with classic libx264 process. BTW cuda solve a lot of things with npp filter and cuda_upload / download on intel this do not work with vavapi i suppose ! Link to comment Share on other sites More sharing options...
KingDaveRa 2 Posted February 17, 2017 Share Posted February 17, 2017 FWIW, I've made some progress. Vaapi relies on your graphics drivers in mesa supporting encode and decode profiles. Radeon support for encode was only added in Mesa 13, and Ubuntu 16.x is on Mesa 12. There's a PPA containing Mesa 13 here. Upgraded to that, and I have encode profiles now! But it still doesn't work from Emby. The error I get is: {"Protocol":"File","Id":"ee6e90526820872c60c652d44fee7e38","Path":"/data/media/TV/Video.avi","Type":"Default","Container":"avi","Name":"SD/MPEG4/MP3","IsRemote":false,"ETag":"04c53d64053f4bafe832498d65af76a1","RunTimeTicks":12408229888,"ReadAtNativeFramerate":false,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"RequiresClosing":false,"SupportsProbing":true,"VideoType":"VideoFile","MediaStreams":[{"Codec":"mpeg4","CodecTag":"XVID","TimeBase":"1001/24000","CodecTimeBase":"911/21845","IsInterlaced":false,"BitRate":1436434,"RefFrames":1,"IsDefault":false,"IsForced":false,"Height":384,"Width":512,"AverageFrameRate":23.97602,"RealFrameRate":23.97602,"Profile":"Advanced Simple Profile","Type":"Video","AspectRatio":"4:3","Index":0,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"PixelFormat":"yuv420p","Level":3,"IsAnamorphic":false},{"Codec":"mp3","TimeBase":"1/15963","CodecTimeBase":"1/44100","DisplayTitle":"MP3 stereo","IsInterlaced":false,"ChannelLayout":"stereo","BitRate":127704,"Channels":2,"SampleRate":44100,"IsDefault":false,"IsForced":false,"Type":"Audio","Index":1,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Level":0}],"PlayableStreamFileNames":[],"Formats":[],"Bitrate":1573497,"RequiredHttpHeaders":{}} /opt/ffmpeg/bin/ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -i file:"/data/media/TV/Video.avi" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_vaapi -b:v 1436434 -maxrate 1436434 -bufsize 2872868 -vsync -1 -level 41 -force_key_frames "expr:gte(t,n_forced*3)" -vf "format=nv12|vaapi,hwupload" -copyts -codec:a:0 aac -strict experimental -ac 2 -ab 127704 -af "adelay=1,aresample=async=1" -f segment -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero -segment_time 3 -individual_header_trailer 0 -segment_format mpegts -segment_list_type m3u8 -segment_start_number 0 -segment_list "/var/lib/emby-server/transcoding-temp/819ac7a34a4382012dd1083ee4fefb7b.m3u8" -y "/var/lib/emby-server/transcoding-temp/819ac7a34a4382012dd1083ee4fefb7b%d.ts" ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 6.2.0 (Ubuntu 6.2.0-5ubuntu12) 20161005 configuration: --pkg-config-flags=--static --prefix=/opt/ffmpeg libavutil 55. 34.100 / 55. 34.100 libavcodec 57. 64.101 / 57. 64.101 libavformat 57. 56.100 / 57. 56.100 libavdevice 57. 1.100 / 57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libva info: VA-API version 0.39.2 libva info: va_getDriverName() returns 0 libva info: User requested driver 'radeonsi' libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so libva info: Found init function __vaDriverInit_0_39 libva info: va_openDriver() returns 0 Input #0, avi, from 'file:/data/media/TV/Video.avi': Metadata: encoder : VirtualDubMod 1.5.4.1 (build 2066/release) Duration: 00:20:40.82, start: 0.000000, bitrate: 1573 kb/s Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 512x384 [SAR 1:1 DAR 4:3], 1436 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, s16p, 127 kb/s [h264_vaapi @ 0x55ba717ecc00] B frames are not supported (1). Stream mapping: Stream #0:0 -> #0:0 (mpeg4 (native) -> h264 (h264_vaapi)) Stream #0:1 -> #0:1 (mp3 (native) -> aac (native)) Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height So, progress, but still a way to go. Link to comment Share on other sites More sharing options...
Andy777 21 Posted February 17, 2017 Share Posted February 17, 2017 Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658) Vaapi doesn't like XVID videos very much and the implementation is buggy. Have you tried with basic h264 MKV? Additionally: If you are experimenting you could try (not taking any responsibility) the Padoka PPA. It includes even newer mesa, libva and libdrm which are all part of the equation. You can find it at: https://launchpad.net/~paulo-miguel-dias/+archive/ubuntu/mesa/+packages BR, Andy77 Link to comment Share on other sites More sharing options...
KingDaveRa 2 Posted February 17, 2017 Share Posted February 17, 2017 Still no joy with H.264 {"Protocol":"File","Id":"3c76ab56da5d523e6674e090e38dee3f","Path":"/data/media/TV/Video.mkv","Type":"Default","Container":"mkv","Name":"720P/H264/AC3","IsRemote":false,"ETag":"a1977b9a174880be7414bfac237df41f","RunTimeTicks":13335040000,"ReadAtNativeFramerate":false,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"RequiresClosing":false,"SupportsProbing":true,"VideoType":"VideoFile","MediaStreams":[{"Codec":"h264","Language":"eng","TimeBase":"1/1000","CodecTimeBase":"1001/48000","NalLengthSize":"4","IsInterlaced":false,"IsAVC":true,"BitRate":756057,"BitDepth":8,"RefFrames":9,"IsDefault":true,"IsForced":false,"Height":720,"Width":1280,"AverageFrameRate":23.97602,"RealFrameRate":23.97602,"Profile":"High","Type":"Video","AspectRatio":"16:9","Index":0,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"PixelFormat":"yuv420p","Level":41,"IsAnamorphic":false},{"Codec":"ac3","TimeBase":"1/1000","CodecTimeBase":"1/48000","DisplayTitle":"Dolby Digital stereo Default","IsInterlaced":false,"ChannelLayout":"stereo","BitRate":384000,"Channels":2,"SampleRate":48000,"IsDefault":true,"IsForced":false,"Type":"Audio","Index":1,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Level":0}],"PlayableStreamFileNames":[],"Formats":[],"Bitrate":756057,"RequiredHttpHeaders":{}} /opt/ffmpeg/bin/ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -i file:"/data/media/TV/Video.mkv" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_vaapi -b:v 616000 -maxrate 616000 -bufsize 1232000 -vsync -1 -level 41 -force_key_frames "expr:gte(t,n_forced*3)" -vf "format=nv12|vaapi,hwupload,scale_vaapi=w=720:h=404" -copyts -codec:a:0 aac -strict experimental -ac 2 -ab 384000 -af "adelay=1,aresample=async=1" -f segment -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero -segment_time 3 -individual_header_trailer 0 -segment_format mpegts -segment_list_type m3u8 -segment_start_number 0 -segment_list "/var/lib/emby-server/transcoding-temp/03254ba5b17ebc707ba61bc91cec6240.m3u8" -y "/var/lib/emby-server/transcoding-temp/03254ba5b17ebc707ba61bc91cec6240%d.ts" ffmpeg version 3.2.2 Copyright © 2000-2016 the FFmpeg developers built with gcc 6.2.0 (Ubuntu 6.2.0-5ubuntu12) 20161005 configuration: --pkg-config-flags=--static --prefix=/opt/ffmpeg libavutil 55. 34.100 / 55. 34.100 libavcodec 57. 64.101 / 57. 64.101 libavformat 57. 56.100 / 57. 56.100 libavdevice 57. 1.100 / 57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libva info: VA-API version 0.39.2 libva info: va_getDriverName() returns 0 libva info: User requested driver 'radeonsi' libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so libva info: Found init function __vaDriverInit_0_39 libva info: va_openDriver() returns 0 Input #0, matroska,webm, from 'file:/data/media/TV/Video.mkv': Metadata: encoder : libebml v0.7.7 + libmatroska v0.8.1 creation_time : 2012-01-12T17:13:45.000000Z Duration: 00:22:13.50, start: 0.000000, bitrate: 756 kb/s Stream #0:0(eng): Video: h264 (High), yuv420p(progressive), 1280x720, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default) Stream #0:1: Audio: ac3, 48000 Hz, stereo, fltp, 384 kb/s (default) [h264_vaapi @ 0x55f1701f84c0] B frames are not supported (1). Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_vaapi)) Stream #0:1 -> #0:1 (ac3 (native) -> aac (native)) Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height I did see the paoka PPA, but the fact it was built from nightlies put me off. That said, I don't rely on xorg or anything graphical on the box, so I could give it a whirl. I'll ponder that! Link to comment Share on other sites More sharing options...
libnc 0 Posted February 17, 2017 Share Posted February 17, 2017 (edited) In my case if i select a 480p wide and preserv other simple params i get good resuts. i update to the last ppa verison of jonathonf. i want to try this yu'll find Dave, but outside of emby. PS: i test it, but no succes with params do not work! even outside emby Edited February 18, 2017 by libnc Link to comment Share on other sites More sharing options...
dnacore 0 Posted February 20, 2017 Share Posted February 20, 2017 Still no joy with H.264 I did see the paoka PPA, but the fact it was built from nightlies put me off. That said, I don't rely on xorg or anything graphical on the box, so I could give it a whirl. I'll ponder that! I'm also still confused about vaapi with my rx460. Can you explain how to achieve this far? I always get "[scale_vaapi @ 0x234c860] Hardware does not support output format nv12." error when trying vaapi on radeon. WIth onboard Intel GPU it was working well. Link to comment Share on other sites More sharing options...
dnacore 0 Posted February 21, 2017 Share Posted February 21, 2017 FWIW, I've made some progress. Vaapi relies on your graphics drivers in mesa supporting encode and decode profiles. Radeon support for encode was only added in Mesa 13, and Ubuntu 16.x is on Mesa 12. There's a PPA containing Mesa 13 here. Upgraded to that, and I have encode profiles now! But it still doesn't work from Emby. The error I get is: {"Protocol":"File","Id":"ee6e90526820872c60c652d44fee7e38","Path":"/data/media/TV/Video.avi","Type":"Default","Container":"avi","Name":"SD/MPEG4/MP3","IsRemote":false,"ETag":"04c53d64053f4bafe832498d65af76a1","RunTimeTicks":12408229888,"ReadAtNativeFramerate":false,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"RequiresClosing":false,"SupportsProbing":true,"VideoType":"VideoFile","MediaStreams":[{"Codec":"mpeg4","CodecTag":"XVID","TimeBase":"1001/24000","CodecTimeBase":"911/21845","IsInterlaced":false,"BitRate":1436434,"RefFrames":1,"IsDefault":false,"IsForced":false,"Height":384,"Width":512,"AverageFrameRate":23.97602,"RealFrameRate":23.97602,"Profile":"Advanced Simple Profile","Type":"Video","AspectRatio":"4:3","Index":0,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"PixelFormat":"yuv420p","Level":3,"IsAnamorphic":false},{"Codec":"mp3","TimeBase":"1/15963","CodecTimeBase":"1/44100","DisplayTitle":"MP3 stereo","IsInterlaced":false,"ChannelLayout":"stereo","BitRate":127704,"Channels":2,"SampleRate":44100,"IsDefault":false,"IsForced":false,"Type":"Audio","Index":1,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Level":0}],"PlayableStreamFileNames":[],"Formats":[],"Bitrate":1573497,"RequiredHttpHeaders":{}} /opt/ffmpeg/bin/ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -i file:"/data/media/TV/Video.avi" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_vaapi -b:v 1436434 -maxrate 1436434 -bufsize 2872868 -vsync -1 -level 41 -force_key_frames "expr:gte(t,n_forced*3)" -vf "format=nv12|vaapi,hwupload" -copyts -codec:a:0 aac -strict experimental -ac 2 -ab 127704 -af "adelay=1,aresample=async=1" -f segment -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero -segment_time 3 -individual_header_trailer 0 -segment_format mpegts -segment_list_type m3u8 -segment_start_number 0 -segment_list "/var/lib/emby-server/transcoding-temp/819ac7a34a4382012dd1083ee4fefb7b.m3u8" -y "/var/lib/emby-server/transcoding-temp/819ac7a34a4382012dd1083ee4fefb7b%d.ts" ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 6.2.0 (Ubuntu 6.2.0-5ubuntu12) 20161005 configuration: --pkg-config-flags=--static --prefix=/opt/ffmpeg libavutil 55. 34.100 / 55. 34.100 libavcodec 57. 64.101 / 57. 64.101 libavformat 57. 56.100 / 57. 56.100 libavdevice 57. 1.100 / 57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libva info: VA-API version 0.39.2 libva info: va_getDriverName() returns 0 libva info: User requested driver 'radeonsi' libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so libva info: Found init function __vaDriverInit_0_39 libva info: va_openDriver() returns 0 Input #0, avi, from 'file:/data/media/TV/Video.avi': Metadata: encoder : VirtualDubMod 1.5.4.1 (build 2066/release) Duration: 00:20:40.82, start: 0.000000, bitrate: 1573 kb/s Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 512x384 [SAR 1:1 DAR 4:3], 1436 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, s16p, 127 kb/s [h264_vaapi @ 0x55ba717ecc00] B frames are not supported (1). Stream mapping: Stream #0:0 -> #0:0 (mpeg4 (native) -> h264 (h264_vaapi)) Stream #0:1 -> #0:1 (mp3 (native) -> aac (native)) Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height So, progress, but still a way to go. I already on this step. Did you try -bf 0 yet? As some users report that Polaris does not support b-frames. Link to comment Share on other sites More sharing options...
bigd271 0 Posted February 23, 2017 Share Posted February 23, 2017 Forgive my ignorance, but two questions: 1. Is this setup for encoding (i.e. recording my scheduled programs)? My CPU is under heavy load, and I cannot record more than 1 stream but would like to. 2. Does this work on the Docker installation? or should I be running this on the native Ubuntu 16.04 server install that is the current docker host? I've ran a few of the commands I've found throughout this discussion (both inside my container and out) and it appears that ffmpeg may not be configured for vaapi in Docker, but perhaps due to the nature of running inside the container? Many thanks. Link to comment Share on other sites More sharing options...
Luke 37113 Posted February 23, 2017 Share Posted February 23, 2017 hi @@bigd271, this does not apply to recordings although we may add this in the future. Yes it will work with Docker. Let us know if this helps. Thanks ! 1 Link to comment Share on other sites More sharing options...
Critter 0 Posted February 28, 2017 Share Posted February 28, 2017 Has anybody got this working with an AMD Radeon APU? I've got an A8-7600 which has a Radeon R7 core (Kaveri). All I've read says that AMD VCE v2 is built into it, so it should be capable. I'm on Ubuntu server 16.10 x64. I've installed mesa and the drivers. I've got an environment variable of LIBVA_DRIVER_NAME="radeonsi" so it can find the correct driver. If I run vainfo: ..... I've tried it with X running, and without and I get the same error, and I don't think you even need X running for it to workanyway. At least, I hope not as the box runs headless anyway. Anybody have any experience with this, as it's driving me nutty?! You have a Intel CPU and a AMD GPU? Then your Intel ist 129 --> /dev/dri/renderD129 , not 128 I have a problem with hevc. h264 works fine. If I encode a video in hevc_vaapi, then the video is stuttering. Looks like 2 frames in front, 1 frame back, 2 frames in front, 1 frame back Have any1 the same problem? I have test it with Ubuntu 16.04 and 16.10, wirth Celeron (Skylake and Kaby) and i5 (Skylake). Result is the same :/ Link to comment Share on other sites More sharing options...
Econaut 1 Posted November 14, 2017 Share Posted November 14, 2017 Emby fails for me but if I use: ffmpeg -vaapi_device /dev/dri/renderD128 -i input.mkv -vf 'format=nv12,hwupload' -c:v h264_vaapi -bf 0 output.mkv The encode will start. Without `-bf 0` it fails due to not supporting B frames. :~$ vainfo libva info: VA-API version 0.40.0 libva info: va_getDriverName() returns 0 libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so libva info: Found init function __vaDriverInit_0_40 libva info: va_openDriver() returns 0 vainfo: VA-API version: 0.40 (libva ) vainfo: Driver version: mesa gallium vaapi vainfo: Supported profile and entrypoints VAProfileMPEG2Simple : VAEntrypointVLD VAProfileMPEG2Main : VAEntrypointVLD VAProfileVC1Simple : VAEntrypointVLD VAProfileVC1Main : VAEntrypointVLD VAProfileVC1Advanced : VAEntrypointVLD VAProfileH264ConstrainedBaseline: VAEntrypointVLD VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice VAProfileH264Main : VAEntrypointVLD VAProfileH264Main : VAEntrypointEncSlice VAProfileH264High : VAEntrypointVLD VAProfileH264High : VAEntrypointEncSlice VAProfileHEVCMain : VAEntrypointVLD VAProfileHEVCMain10 : VAEntrypointVLD VAProfileJPEGBaseline : VAEntrypointVLD VAProfileNone : VAEntrypointVideoProc Link to comment Share on other sites More sharing options...
Luke 37113 Posted November 14, 2017 Share Posted November 14, 2017 Where's the log of the failure? Link to comment Share on other sites More sharing options...
Econaut 1 Posted November 14, 2017 Share Posted November 14, 2017 Where's the log of the failure? This is all that was printed in the log but I ran the command manually also /opt/emby-server/bin/ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -i file:"input.mkv" -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_vaapi -force_key_frames "expr:gte(t,n_forced*5)" -vf "format=nv12|vaapi,hwupload,scale_vaapi=w=720:h=300" -b:v 1116000 -maxrate 1116000 -bufsize 2232000 -level 41 -vsync -1 -map_metadata -1 -map_chapters -1 -threads 8 -codec:a:0 aac -strict experimental -ac 2 -ab 384000 -ar 44100 -af "volume=2" -y "output.mkv" ffmpeg version 3.4 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 6.3.0 (crosstool-NG crosstool-ng-1.23.0) configuration: --enable-cross-compile --cross-prefix=x86_64-pc-linux-gnu- --arch=x86_64 --target-os=linux --prefix=/srv/buildbot/x64/staging --pkg-config=pkg-config --disable-static --disable-cuda --disable-cuvid --disable-iconv --disable-nvenc --disable-doc --disable-ffplay --disable-ffserver --disable-xlib --enable-shared --enable-fontconfig --enable-gnutls --enable-gpl --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libwebp --enable-libx264 --enable-libzvbi --enable-vaapi --extra-libs='-ldl -ldrm -lexpat -lfreetype -lfribidi -lfontconfig -lgmp -lhogweed -lnettle -lpng' libavutil 55. 78.100 / 55. 78.100 Manual: :~$ ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -i file:"$HOME/input.mkv" -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_vaapi -force_key_frames "expr:gte(t,n_forced*5)" -vf "format=nv12|vaapi,hwupload,scale_vaapi=w=720:h=300" -b:v 1116000 -maxrate 1116000 -bufsize 2232000 -level 41 -vsync -1 -map_metadata -1 -map_chapters -1 -threads 8 -codec:a:0 aac -strict experimental -ac 2 -ab 384000 -ar 44100 -af "volume=2" -y "$HOME/output.mkv" ffmpeg version 3.3.4-2 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 7 (Ubuntu 7.2.0-8ubuntu2) configuration: --prefix=/usr --extra-version=2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 58.100 / 55. 58.100 libavcodec 57. 89.100 / 57. 89.100 libavformat 57. 71.100 / 57. 71.100 libavdevice 57. 6.100 / 57. 6.100 libavfilter 6. 82.100 / 6. 82.100 libavresample 3. 5. 0 / 3. 5. 0 libswscale 4. 6.100 / 4. 6.100 libswresample 2. 7.100 / 2. 7.100 libpostproc 54. 5.100 / 54. 5.100 libva info: VA-API version 0.40.0 libva info: va_getDriverName() returns 0 libva info: User requested driver 'radeonsi' libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so libva info: Found init function __vaDriverInit_0_40 libva info: va_openDriver() returns 0 [matroska,webm @ 0x55d80c3deee0] Could not find codec parameters for stream 2 (Subtitle: hdmv_pgs_subtitle): unspecified size Consider increasing the value for the 'analyzeduration' and 'probesize' options Input #0, matroska,webm, from 'file:input.mkv': Metadata: title : input DATE_RELEASED : 2016 creation_time : 2017-11-08T06:06:03.000000Z ENCODER : Lavf57.71.100 Duration: 03:02:33.65, start: 0.000000, bitrate: 7306 kb/s Chapter #0:0: start 0.000000, end 610.693000 Metadata: title : 00:00:00.000 Chapter #0:1: start 610.693000, end 1620.869000 Metadata: title : 00:10:10.652 Chapter #0:2: start 1620.869000, end 2269.225000 Metadata: title : 00:27:00.661 Chapter #0:3: start 2269.225000, end 2814.562000 Metadata: title : 00:37:49.225 Chapter #0:4: start 2814.562000, end 3725.013000 Metadata: title : 00:46:54.520 Chapter #0:5: start 3725.013000, end 4450.780000 Metadata: title : 01:02:04.971 Chapter #0:6: start 4450.780000, end 5287.199000 Metadata: title : 01:14:10.613 Chapter #0:7: start 5287.199000, end 6106.642000 Metadata: title : 01:28:07.115 Chapter #0:8: start 6106.642000, end 6832.617000 Metadata: title : 01:41:46.642 Chapter #0:9: start 6832.617000, end 7378.162000 Metadata: title : 01:53:52.617 Chapter #0:10: start 7378.162000, end 8104.221000 Metadata: title : 02:02:58.079 Chapter #0:11: start 8104.221000, end 8875.283000 Metadata: title : 02:15:04.054 Chapter #0:12: start 8875.283000, end 9411.527000 Metadata: title : 02:27:55.075 Chapter #0:13: start 9411.527000, end 10107.514000 Metadata: title : 02:36:51.444 Chapter #0:14: start 10107.514000, end 10484.057000 Metadata: title : 02:48:27.514 Chapter #0:15: start 10484.057000, end 10953.610000 Metadata: title : 02:54:43.765 Stream #0:0: Video: hevc (Main), yuv420p(tv, bt709), 1920x800 [SAR 1:1 DAR 12:5], 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default) Metadata: DURATION : 03:02:33.651000000 Stream #0:1(eng): Audio: truehd, 48000 Hz, 7.1, s32 (24 bit) (default) Metadata: title : Surround DURATION : 03:02:33.652000000 Stream #0:2(eng): Subtitle: hdmv_pgs_subtitle (default) (forced) Metadata: DURATION : 03:02:31.566000000 Stream mapping: Stream #0:0 -> #0:0 (hevc (native) -> h264 (h264_vaapi)) Stream #0:1 -> #0:1 (truehd (native) -> aac (native)) Press [q] to stop, [?] for help [scale_vaapi @ 0x55d80c950420] Failed to render parameter buffer: 6 (invalid VASurfaceID). Error while filtering Failed to inject frame into filter network: Input/output error Error while processing the decoded data for stream #0:0 [aac @ 0x55d80c876b00] Qavg: 53744.254 [aac @ 0x55d80c876b00] 2 frames left in the queue on closing Conversion failed! Link to comment Share on other sites More sharing options...
Luke 37113 Posted November 14, 2017 Share Posted November 14, 2017 I think this might be related to the input video because we're obviously not seeing this failure across the board. Link to comment Share on other sites More sharing options...
Andy777 21 Posted November 14, 2017 Share Posted November 14, 2017 Or related to the very buggy AMD Vaapi implementation. If it is not input video related it should be reported to the ffmpeg bug tracker. They will work around it and/or report it upstream. AMD is not currently paying very much attention to Vaapi. Link to comment Share on other sites More sharing options...
Econaut 1 Posted November 16, 2017 Share Posted November 16, 2017 (edited) I think this might be related to the input video because we're obviously not seeing this failure across the board. This was the file info: General Format : Matroska Format version : Version 4 / Version 2 File size : 9.32 GiB Duration : 3 h 2 min Overall bit rate mode : Variable Overall bit rate : 7 307 kb/s Encoded date : UTC 2017-11-08 06:06:03 Writing application : HandBrake 1.0.7 2017082500 Writing library : Lavf57.71.100 ErrorDetectionType : Per level 1 Video ID : 1 Format : HEVC Format/Info : High Efficiency Video Coding Format profile : Main@L4@Main Codec ID : V_MPEGH/ISO/HEVC Duration : 3 h 2 min Width : 1 920 pixels Height : 800 pixels Display aspect ratio : 2.40:1 Frame rate mode : Constant Frame rate : 23.976 (24000/1001) FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Writing library : x265 2.5:[Linux][GCC 7.1.0][64 bit] 8bit+10bit+12bit Encoding settings : cpuid=1173503 / frame-threads=4 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=1920x800 / interlace=0 / total-frames=0 / level-idc=0 / high-tier=1 / uhd-bd=0 / ref=4 / no-allow-non-conformance / no-repeat-headers / annexb / no-aud / no-hrd / info / hash=0 / no-temporal-layers / open-gop / min-keyint=24 / keyint=240 / bframes=4 / b-adapt=2 / b-pyramid / bframe-bias=0 / rc-lookahead=25 / lookahead-slices=4 / scenecut=40 / no-intra-refresh / ctu=64 / min-cu-size=8 / rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=2 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / strong-intra-smoothing / max-merge=3 / limit-refs=3 / limit-modes / me=3 / subme=3 / merange=57 / temporal-mvp / weightp / no-weightb / no-analyze-src-pics / deblock=0:0 / sao / no-sao-non-deblock / rd=4 / no-early-skip / rskip / no-fast-intra / no-tskip-fast / no-cu-lossless / no-b-intra / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=1.00 / no-rd-refine / analysis-reuse-mode=0 / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=23.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / ipratio=1.40 / pbratio=1.30 / aq-mode=1 / aq-strength=1.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=1 / overscan=0 / videoformat=5 / range=0 / colorprim=1 / transfer=1 / colormatrix=1 / chromaloc=0 / display-window=0 / max-cll=0,0 / min-luma=0 / max-luma=255 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / opt-qp-pps / opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / no-opt-cu-delta-qp / no-aq-motion / no-hdr / no-hdr-opt / no-dhdr10-opt / analysis-reuse-level=5 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=0 / no-limit-sao / ctu-info=0 Default : Yes Forced : No Color range : Limited Color primaries : BT.709 Transfer characteristics : BT.709 Matrix coefficients : BT.709 Audio ID : 2 Format : TrueHD Format profile : TrueHD+Atmos / TrueHD Codec ID : A_TRUEHD Duration : 3 h 2 min Bit rate mode : Variable Maximum bit rate : 8 199 kb/s Channel(s) : Object Based / 8 channels Channel positions : Object Based / Front: L C R, Side: L R, Back: L R, LFE Sampling rate : / 48.0 kHz Frame rate : 1 200.000 FPS (40 SPF) Compression mode : Lossless Title : Surround Language : English Default : Yes Forced : No Text ID : 3 Format : PGS Codec ID : S_HDMV/PGS Duration : 3 h 2 min Language : English Default : Yes Forced : Yes Other files have the same issue though. Or related to the very buggy AMD Vaapi implementation. If it is not input video related it should be reported to the ffmpeg bug tracker. They will work around it and/or report it upstream. AMD is not currently paying very much attention to Vaapi. Is there a more appropriate method for AMD GPU's? Edited November 16, 2017 by Xen0sys Link to comment Share on other sites More sharing options...
Andy777 21 Posted November 16, 2017 Share Posted November 16, 2017 This was the file info: Format : HEVC Other files have the same issue though. Is there a more appropriate method for AMD GPU's? Are all the other files also HEVC? Have you tried with H264 input? I've seen successful AMD examples where the -bf0 was not required. Anyway: AMD is actually trying to improve encoding right now. Quote from the mesa-devel this month: "So, does this mean we could actually implement VAAPI encode properly with packed headers now rather than hard-coding all of this in the driver?" "At least that's the intention here." Link to the discussion and the patch set: https://lists.freedesktop.org/archives/mesa-dev/2017-November/176176.html But it should work without specifying -bf0. The driver should report the capabilities and ffmpeg should not try to implement the b-frames (rather than crash). BTW. Did you notice that in your command line example you used a different ffmpeg version than what was in the emby log? 1 Link to comment Share on other sites More sharing options...
casperghst42 3 Posted November 17, 2017 Share Posted November 17, 2017 It works like charm if you follow intel media studio instructions to the letter. Mostly people just miss the part where the (short) list of supported (= the only ones that will work) CPUs is. With Intel media studio 2017 you need to have (excluding the respective Xeon models): 5th Generation (Broadwell) Core i3, i5 or i7 or 6th Generation (Skylake) Core i3, i5 or i7 Older CPU (like Haswell) -> no quicksync on linux New or old Pentium/Celeron/Atom/etc. -> no quicksync on linux BR, Andy777 This might not be 100% correct, I have HW encoding with a G4600 under Debian 9. But using VAAPI, not QVC. But something is correct, there is no Media Studio support for E3 v6. Casper 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now