Firefly Open Source Community

   Login   |   Register   |
New_Topic
1234
New Topic

Hardware decoder on linux for firefly-rk3288(source opened)

24

Credits

0

Prestige

0

Contribution

new registration

Rank: 1

Credits
24
Posted at 1/6/2016 19:19:20     
mac_l1 Posted at 1/3/2016 14:11
Hi,
See: https://github.com/mac-l1/machybris_examples/blob/master/recorder/h264recorder.cpp#L158. ...

Hi mac_l1:
can you give me screenrecoderh264 for testing HW encoder
Reply

Use props Report

844

Credits

42

Prestige

48

Contribution

advanced

Rank: 4

Credits
844
Posted at 1/6/2016 23:24:28     
Attached zip file with two files in it (one binary, one shell script).
Use the script to capture the screen, the recording is stopped by pressing a key:
  1. ./screenrecord_h264.sh test.mp4
Copy the code
You should have installed machybris before, and also avconv (sudo apt-get install libav-tools).

Every frame is captured from framebuffer device /dev/fb0. Using shared memory this RGB frame is converted to YUV420SP / NV21 format using the RGA hardware module. This YUV frame is then given to the encoder using the raw vpu api that generates an h264 bitstream. After key-press this h264 bitstream file is then encapsulated into a movie-container (mp4 in this case) by avconv utility.

You can see some android logging by:
  1. sudo /system/bin/logcat
Copy the code
You can see some kernel logging by:
  1. sudo tail -f /var/log/syslog
Copy the code
Hope this helps.


Cheers -- mac_l1


h264recorder.zip

45.93 KB, Down times: 26

Reply

Use props Report

106

Credits

0

Prestige

0

Contribution

registered members

Rank: 2

Credits
106
Posted at 1/6/2016 23:40:15     
@mac_l1, @isle,

Do you think that it's possible to add 4K support (maybe with display improvement) ?
I can't see in sourcecode where 4K is forbidden ! Can you show me where i can find such thing ?

Reply

Use props Report

1821

Credits

10

Prestige

17

Contribution

super moderator

Rank: 8Rank: 8

Credits
1821
Posted at 1/7/2016 09:49:26     
Last edited by isle In 1/7/2016 09:51 Editor

Hi fd101283.
the 4k video  hasn't be  forbbidened on this sourcecode.  
but when playing 4k video ,the ffplay sometimes get rong video width&height .like "avctx->width=0 & avctx->height=0";in the initializtion function "rkdec_prepare".
so you need give them the width&height  value before "rkdec_ctx->ctx->init".
after init is done ,the decoder works. Now your can get the real width&height "pframe->DisplayWidth" by "rkdec_ctx->vpu_mem_link(&pframe->vpumem);".
this is what I get. when i playing 4k videos.

If someone can make the display woking well on 4k.that must be excellent.
But if you just need deocode with 4k , display with HD or FHD. you can use rga to do downscale.thay is a way to get 4k woks.
haha!



Reply

Use props Report

24

Credits

0

Prestige

0

Contribution

new registration

Rank: 1

Credits
24
Posted at 1/7/2016 15:54:44     
mac_l1 Posted at 1/6/2016 23:24
Attached zip file with two files in it (one binary, one shell script).
Use the script to capture th ...

thank you for your help!
screenrecord_h264.sh called bin file h264recorder, Where can I get the source code of h264recorder?

thanks
Reply

Use props Report

844

Credits

42

Prestige

48

Contribution

advanced

Rank: 4

Credits
844
Posted at 1/7/2016 15:59:02     
346409941 Posted at 1/7/2016 15:54
thank you for your help!
screenrecord_h264.sh called bin file h264recorder, Where can I get the s ...

Here is the source code:
  1. git clone https://github.com/mac-l1/machybris_examples.git
Copy the code

Look in the recorder folder for the screenrecorder.
Cheers! mac_l1
Reply

Use props Report

106

Credits

0

Prestige

0

Contribution

registered members

Rank: 2

Credits
106
Posted at 1/7/2016 18:31:35     
Hi Isle,

Thanks alot for the explanation...It's very great job that you've done.

I try to modify source code in order to decode 4K. As a result i always get errors before decoding. This is the log :

  1. Firefly@firefly:~/Downloads/firefly-vpu-linux$ ./ffplay Astra_Canal_UHD.ts
  2. ffplay version 2.6.3 Copyright (c) 2003-2015 the FFmpeg developers
  3.   built with gcc 4.8 (Ubuntu/Linaro 4.8.4-2ubuntu1~14.04)
  4.   configuration: --enable-shared --prefix=/usr --disable-ffmpeg --disable-ffprobe --disable-ffserver --disable-static
  5.   libavutil      54. 20.100 / 54. 20.100
  6.   libavcodec     56. 26.100 / 56. 26.100
  7.   libavformat    56. 25.101 / 56. 25.101
  8.   libavdevice    56.  4.100 / 56.  4.100
  9.   libavfilter     5. 11.102 /  5. 11.102
  10.   libswscale      3.  1.101 /  3.  1.101
  11.   libswresample   1.  1.100 /  1.  1.100
  12. [hevc @ 0xb3922dc0] nb threads_frame = 1, nb threads_slice 1, thread_type = null
  13. [hevc @ 0xb3908220] nb threads_frame = 1, nb threads_slice 1, thread_type = null
  14. [hevc @ 0xb3922880] nb threads_frame = 1, nb threads_slice 1, thread_type = null
  15. [hevc_rkvpu @ 0xb39044a0] PPS id out of range: 0
  16. [hevc @ 0xb3908220] PPS id out of range: 0
  17. [hevc @ 0xb3908220] Error parsing NAL unit #2.
  18. Error while decoding frame
  19. get frame failed ret -1004
  20. Something wrong during decode!!!
  21. get frame failed ret -1004
  22. Something wrong during decode!!!
  23. get frame failed ret -1004
  24. Something wrong during decode!!!
  25. get frame failed ret -1004
  26. Something wrong during decode!!!
  27.     Last message repeated 2 times
  28. get frame failed ret -10040 aq=    0KB vq=    0KB sq=    0B f=0/0   
  29. Something wrong during decode!!!
  30. get frame failed ret -1004
  31. Something wrong during decode!!!
  32. get frame failed ret -1004
  33. Something wrong during decode!!!
  34. get frame failed ret -1004
  35. Something wrong during decode!!!
  36. get frame failed ret -1004
  37. Something wrong during decode!!!
  38. get frame failed ret -1004
  39. Something wrong during decode!!!
  40. get frame failed ret -1004
  41. Something wrong during decode!!!
  42. get frame failed ret -1004
  43. Something wrong during decode!!!
  44. get frame failed ret -1004
  45. Something wrong during decode!!!
  46. get frame failed ret -1004
  47. Something wrong during decode!!!
Copy the code

Reply

Use props Report

1821

Credits

10

Prestige

17

Contribution

super moderator

Rank: 8Rank: 8

Credits
1821
Posted at 1/8/2016 09:25:44     
Oh,
"[hevc_rkvpu @ 0xb39044a0] PPS id out of range: 0"
This is very strange.
have you try another 4k video ?and get the some mistake?  
Reply

Use props Report

106

Credits

0

Prestige

0

Contribution

registered members

Rank: 2

Credits
106
Posted at 1/8/2016 16:20:11     
Yes, the same stream works well with android player...
And i also try with some other stream and it give the same problem...
Reply

Use props Report

106

Credits

0

Prestige

0

Contribution

registered members

Rank: 2

Credits
106
Posted at 1/8/2016 20:55:18     
This is the stream which gives problems :

http://www.filedropper.com/astracanaluhd
Reply

Use props Report

Return to List
1234
You need to log in before you can reply Login | Register

This forum Credits Rules

Quick Reply Back to top Back to list