Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't translate ffmpeg command into javacv #538

Closed
fcinfo opened this issue Mar 15, 2018 · 15 comments
Closed

Can't translate ffmpeg command into javacv #538

fcinfo opened this issue Mar 15, 2018 · 15 comments

Comments

@fcinfo
Copy link

fcinfo commented Mar 15, 2018

I can run under command successfuly:
ffmpeg -hwaccel qsv -c:v h264_qsv -rtsp_transport tcp -i rtsp://admin:[email protected] -f flv -vcodec h264_qsv rtmp://193.169.100.222/live/stream1

what to do translate it into javacv ?

@saudet
Copy link
Member

saudet commented Mar 16, 2018

If you're facing any issues in particular, please also provide the error message you get! Thanks

@fcinfo
Copy link
Author

fcinfo commented Mar 17, 2018

I'm sorry. I can use FfmpegFrameRecorder.setVideoCodecName(“h264_qsv”) to specify encoder,
I don't know how to set accelerators and decoders for FfmpegFrameGrabber,I use
grabber.setOption(“hwaccel”,“qsv”);
grabber.setOption(“c:v”,“h264_qsv”);
but I didn't find the accelerator and decoder used in decoding.

@saudet
Copy link
Member

saudet commented Mar 17, 2018

We will need to add calls to avcodec_find_decoder_by_name() along those to avcodec_find_decoder() in FFmpegFrameGrabber, and also add similar fields as with FrameRecorder but to FrameGrabber to be able to specify the names of the codecs.

Please let me know if you are having issues making the modifications and I will help! Thanks

@fcinfo
Copy link
Author

fcinfo commented Mar 17, 2018

It's great.Thanks!
Are there any plans to release the next release?

@saudet
Copy link
Member

saudet commented Mar 18, 2018

Are you having any issues making the modifications yourself?

@fcinfo
Copy link
Author

fcinfo commented Mar 18, 2018

The instance of AVCodec can be find by the method AvCodec.avcodec_find_decoder_by_name(),but I don't know how to use this instance,the method grabber.setVideoCodec only need int.

@saudet
Copy link
Member

saudet commented Mar 18, 2018

Right, so we need to add setVideoCodecName() and setAudioCodecName() for that.

@fcinfo
Copy link
Author

fcinfo commented Mar 19, 2018

After I modified the code, the decoder do not work correctly:
[NULL @ 0000000041433620] missing picture in access unit with size 1
[NULL @ 0000000041433620] missing picture in access unit with size 2
[NULL @ 0000000041433620] missing picture in access unit with size 3.
Another the encoder(h264_qsv) cannot work too:
[h264_qsv @ 0000000044b225e0] More than one of: { constant qscale, lookahead, VCM } requested, only one of them can be used at a time.
I don't know how to set the three parameters above?

@saudet
Copy link
Member

saudet commented Mar 19, 2018

Me neither, someone will need to read documentation, study the code, ask the developers of FFmpeg, etc...

@fcinfo
Copy link
Author

fcinfo commented Mar 21, 2018

grabber.setPixelFormat(avutil.AV_PIX_FMT_YUV420P);
All the colors of video are lost, It's only going to be avutil.AV_PIX_FMT_BGR24.
why?

@saudet
Copy link
Member

saudet commented Mar 21, 2018

You'll needto use something that supports that pixel format for display to see the colors.

@fcinfo
Copy link
Author

fcinfo commented Mar 27, 2018

Hi:
I have modified some code to realize the required functions, but the modified code is limited to FFmpeg part, and I am not sure whether it is in accordance with your logic, so I have emailed you the revised code, please check it.
Thanks.

@saudet
Copy link
Member

saudet commented Mar 27, 2018

That's great! Could please send a pull request instead? Thank you!
https://github.com/bytedeco/javacv/pulls

@saudet
Copy link
Member

saudet commented Mar 28, 2018

Thanks for pull bytedeco/javacv#948!

@saudet
Copy link
Member

saudet commented Mar 24, 2019

BTW, if the ffmpeg program is sufficient, with commit 13ffffd it now gets bundled and can be used easily from Java.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants