Choppy video and avcodec-hw
Posted: 10 Jun 2015 10:55
I am developing a small windows program that plays video using libVLC, I have a weird issue, 4k video are choppy when played by my program but they plays well from vlc.
I enabled logging and noticed that when video is played by my program there are the following lines:
avcodec debug: allowing 4 thread(s) for decoding
avcodec warning: threaded frame decoding is not compatible with DXVA2, disabled
avcodec debug: avcodec codec (H264 - MPEG-4 AVC (part 10)) started
avcodec debug: using slice thread mode with 4 threads
but when played by VLC:
avcodec debug: allowing 4 thread(s) for decoding
avcodec debug: avcodec codec (H264 - MPEG-4 AVC (part 10)) started
avcodec debug: using frame thread mode with 4 threads
By looking at the vlc source code I see that the value of "avcodec-hw" option disables threaded frame decoding and I guess this causes the choppy video, if I run: "vlc --avcodec-hw myvideo.mp4" I get the same log output and the same choppy video.
So I tried to set "avcodec-hw=none" for libVlc from my program but it seems there is no way, I tried the following:
1) I added the option --avcodec-hw=none to libvlc_new() call.
2) Uncommented avcodec-hw=none in the default config file
3) Specified my own config file with --config and the files contains avcodec-hw=none
It seems that option is not seen by libVlc, I also tried to set the option avcodec-threads just to see whether my method of setting options was wrong but in this case from the log I see the number of thread reflects exactly the number I set with avcodec-threads with all three methods listed above.
I am using VLC v2.2.1 and libvlc_new is called with the following options:
--plugin-path
--no-one-instance
--no-stats
--no-media-library
--no-ignore-config
Is there a way to set avcodec-hw=none so that frame theading doesn't get disabled ?
Thanks,
Gianpaolo
I enabled logging and noticed that when video is played by my program there are the following lines:
avcodec debug: allowing 4 thread(s) for decoding
avcodec warning: threaded frame decoding is not compatible with DXVA2, disabled
avcodec debug: avcodec codec (H264 - MPEG-4 AVC (part 10)) started
avcodec debug: using slice thread mode with 4 threads
but when played by VLC:
avcodec debug: allowing 4 thread(s) for decoding
avcodec debug: avcodec codec (H264 - MPEG-4 AVC (part 10)) started
avcodec debug: using frame thread mode with 4 threads
By looking at the vlc source code I see that the value of "avcodec-hw" option disables threaded frame decoding and I guess this causes the choppy video, if I run: "vlc --avcodec-hw myvideo.mp4" I get the same log output and the same choppy video.
So I tried to set "avcodec-hw=none" for libVlc from my program but it seems there is no way, I tried the following:
1) I added the option --avcodec-hw=none to libvlc_new() call.
2) Uncommented avcodec-hw=none in the default config file
3) Specified my own config file with --config and the files contains avcodec-hw=none
It seems that option is not seen by libVlc, I also tried to set the option avcodec-threads just to see whether my method of setting options was wrong but in this case from the log I see the number of thread reflects exactly the number I set with avcodec-threads with all three methods listed above.
I am using VLC v2.2.1 and libvlc_new is called with the following options:
--plugin-path
--no-one-instance
--no-stats
--no-media-library
--no-ignore-config
Is there a way to set avcodec-hw=none so that frame theading doesn't get disabled ?
Thanks,
Gianpaolo