Record live video in panel

mading1309

Member
Licensed User
Longtime User
My first Thread because I am not able to find a functional way to do.

I need to record a live video of the build camera with some overlay information for example measurement values.

Is there any functional idea recording a video and show the live video in a panel for example?

Using the forums search function does not give a working example or idea.
The RSVideoRecord library doesn't work for me. I can't start recording
http://www.b4x.com/forum/additional...al-updates/16268-rsvideorecord-library-2.html

I am not very familiar with Java or wrapping a library
In the meantime I got some basic experience with B4a

Looking forward some hints or advice.

Mading
 

mading1309

Member
Licensed User
Longtime User
Thanks the reply vb1992 and all others viewed my post
And sorry my delayed answer, I was busy the last days closing an other project.

I use a Sony Xperia 8 for test

I attached my modified example project file. As you can see I just add a few error handlers and log information.
During my last changes I set the parameters of the INIT procedure to default with the result that the live preview wasn't frozen as before and a file is recorded now. The recorded file can't be reviewed with the standard video player comes with the phone. A message comes up, the video can't be played. The former error message doesn't appear with parameters set to default.

The following logs I receive with the version attached as the ZIP file
Leading **** are comments of mine

** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Ready event fired, success = true
Preview started.

*** The preview live video is shown

Info clicked

**** to see the possible screen dimensions. 640 by 480 is supported

Width: 2048, Height: 1536 Size:4
Width: 1632, Height: 1224 Size:4
Width: 1280, Height: 960 Size:4
Width: 640, Height: 480 Size:4

Init clicked
Initialized.

Prepare clicked
Prepared.

Start clicked

**** set the parameters to default values the live video is active
**** set the values of the example the live video is frozen

Started.

Stop clicked

**** the record.stop method seems to hang
**** The menu bar does not return, touch inputs and back key are ignored

**** As soon as I stopped the debugger the record.stop method was
**** completed and the following is recorded by log events

record.stop
record.resetMediarecorder
record.releaseMediarecorder
record.lockcamera
Stopped.
The recorded test file cannot be shown with the standard video player of the mobile.

Thanks for furhter help and ideas to come over the record.stop hang

looking forward further help and information

mading
 

Attachments

  • Capture Video live stream in Panel.zip
    7.1 KB · Views: 457
Upvote 0

vb1992

Well-Known Member
Licensed User
Longtime User
Here is your project, that works on my phone.
I adjusted record.OutputFormat from default to 1
and record.VideoEncoder from default to 2

After you release the recorder you can go to the menu to watch it.

This should work for you

B4X:
 record.OutputFormat = 1
   'public static final Int THREE_GPP
   'Since: API Level 1
   '3GPP media File format
   'Constant Value: 1 (0x00000001)
   'record.OutputFormat = 2
   
   
   
   
   record.setScreenSize(640,480)
   record.AudioEncoder = 0 '1
      
      
      
   record.VideoEncoder = 2 '3
   'public static final Int H263
   'Since: API Level 3
   'Constant Value: 1 (0x00000001)

   'public static final Int H264
   'Since: API Level 3
   'Constant Value: 2 (0x00000002)

   'public static final Int MPEG_4_SP
   'Since: API Level 3
   'Constant Value: 3 (0x00000003)
 

Attachments

  • VideoRecordingWorks.zip
    7.3 KB · Views: 454
Upvote 0

mading1309

Member
Licensed User
Longtime User
Thanks the quick answer, vb1992. I copied the working example to my project folder
Im sorry this hint doesn't work for me.
Then I remembered possible to get more detail information what is going on when I clear the filter option for the log view.



Init clicked
unlock from pid 1847 (mClientPid 1847)
clear mCameraClient (pid 1847)
Process com.sonyericsson.idd.agent (pid 2223) has died.
unsupported parameter: x-pvmf/media-input-node/cap-config-interface;valtype=key_specific_value
VerifyAndSetParameter failed
Client::connect E (pid 1120, client 0x329ac)
Connect to the new client (pid 1120, client 0x329ac)
Use default video fps range [5 30]
Use default video width range [176 1280]
Use default video height range [144 720]
Video encoding bit rate is set to 2000000 bps
Use default video bps range [96000 6000000]
enqueueToast pkg=anywheresoftware.b4a.samples.camera callback=android.app.ITransientNotification$Stub$Proxy@45c810b0 duration=0
Initialized.

Click the INI Menu entrance I got the above log information.
What the line unsupported parameters in detail want tell. I checked google but a lot of information about audio less about video.

Then I clicked on Prepare and finally on Start
for the start click I got the following log information

Start clicked


OMX_VENC_MSG_HIGH process_state_change::3273 Attempt to go to OMX_StateExecuting


VENC_MSG_HIGH venc_start::1133 Received command VENC_CMD_START
VENC_MSG_HIGH venci_process_command::4025 Processing command VENC_CMD_START
VENC_MSG_HIGH venci_init_encoder::1925 qvp_encode_h264_frame


VENC_MSG_HIGH venci_init_encoder::1984 RC: VENC_RC_VBR_CFR
VENC_MSG_HIGH venci_init_encoder::2089 set camcorder rate control config...
VENC_MSG_HIGH venci_start_dsp::566 starting driver1: cmd 2 vencStandard 2 partialRunLengthFlag 1
VENC_MSG_HIGH venci_start_dsp::572 starting driver2: h263AnnexISpt 0 h263AnnexJSpt 0 h263AnnexTSpt 0
VENC_MSG_HIGH venci_start_dsp::578 starting driver3: rcFlag 0 oneMVFlag 0 acdcPredEnable 0
VENC_MSG_HIGH venci_start_dsp::584 starting driver4: roundingBitCtrl 0 rotationFlag 0 maxMVx 1
VENC_MSG_HIGH venci_start_dsp::590 starting driver5: maxMVy 1 fourMVThreshold 2000 ise_mv_cost_fac 1285
VENC_MSG_HIGH venci_start_dsp::594 starting driver6: encFrameHeightInMB 30 encFrameWidthInMB 40
VENC_MSG_HIGH venc_drv_start::435 TE version = 0
VENC_MSG_HIGH Configured_HW::294 Request axi freq 200000
VENC_MSG_HIGH Configured_HW::313 registering app with adsp svc...
VENC_MSG_HIGH Configured_HW::319 ref_frame_buf1.addr -- 0x418b8000 - Fd 31
VENC_MSG_HIGH Configured_HW::322 ref_frame_buf2.addr -- 0x41978000 - Fd 32
VENC_MSG_HIGH Configured_HW::325 enc_frame_buf1.addr -- 0x41520000 - Fd 28
VENC_MSG_HIGH Configured_HW::328 enc_frame_buf2.addr -- 0x416ec000 - Fd 30
VENC_MSG_HIGH Configured_HW::331 enabling videoenc task...
VENC_MSG_HIGH venc_drv_rtos_event_cb::1002 venc_drv_rtos_event_cb (status: 0, module: 0, image: 0)
VENC_MSG_HIGH Configured_HW::334 Enabled VIDEOENCTASK & setting clock 96000000...
VENC_MSG_HIGH venc_drv_start::477 got mod ready in 0 ms
VENC_MSG_HIGH venc_drv_start::501 camcorder pass for DSP
VENC_MSG_HIGH venc_drv_start::535 TE VERSION=0,HighFrameRate=0,send VENC_CONFIG
VENC_MSG_HIGH venc_drv_start::553 send VENC_ACTIVE
VENC_MSG_HIGH venc_drv_rtos_msg_cb::1093 received QDSP_VIDEOENCTASK_VENC_CMD_DONE_MSG for VENC_ACTIVE_CMD
VENC_MSG_HIGH venc_drv_start::587 got active command response
VENC_MSG_PROFILE venci_start_dsp::608 Encoder time taken for invoke from instantiation: 150150
VENC_MSG_HIGH venc_stats_thread_fn::916 stats thread entry
OMX_VENC_MSG_HIGH process_DL_status::4166 got DL status for VENC_CMD_START
OMX_VENC_MSG_HIGH process_DL_status::4208 State Transition from Idle to Executing
OMX_VENC_MSG_ERROR translate_config::3807 Rotation is: 0 in 1900478464
VENC_MSG_HIGH venc_get_syntax_hdr::4766 Getting syntax header
VENC_MSG_HIGH qvp_encode_h264_seq_para_set::1907 sps
VENC_MSG_HIGH qvp_encode_h264_pic_para_set::2097 pps


OMX_VENC_MSG_HIGH encode_frame::2462 pOutput->pBuffer:0x0x41a81008,pOutput->nFilledLen=22
startRecording (pid 1120)


startCameraMode(1) (pid 1120)


startRecordingMode (pid 1120)
enqueueToast pkg=anywheresoftware.b4a.samples.camera callback=android.app.ITransientNotification$Stub$Proxy@45a70d28 duration=0


Started.
VENC_MSG_HIGH venc_drv_write::727 Registering fd =21 luma.addr = 0x41031000,chroma.addr =0x4107C000


VENC_MSG_HIGH venc_drv_write::729 base address:-0x41014000
Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@45923850


Breaking out of the read loop, since the minimum buffer count for read is missed 0


Breaking out of the read loop, since the minimum buffer count for read is missed 0


Breaking out of the read loop, since the minimum buffer count for read is missed 0


Error, the buffer size passed is not compatible 288


Error reading audio input
obtainBuffer timed out (is the CPU pegged?) user=00000097, server=00000097


Breaking out of the read loop, since the minimum buffer count for read is missed 0


Breaking out of the read loop, since the minimum buffer count for read is missed 0


Breaking out of the read loop, since the minimum buffer count for read is missed 0


Breaking out of the read loop, since the minimum buffer count for read is missed 0


Breaking out of the read loop, since the minimum buffer count for read is missed 0


Breaking out of the read loop, since the minimum buffer count for read is missed 0

Are you vb1992 or Is someone more familiar than me with these parameters and information of extended log information and can give me a hint. That will be nice.

Looking forward the information
Thanks for your help in advance

Mading
 
Upvote 0

vb1992

Well-Known Member
Licensed User
Longtime User
I assume you are not removing any permissions?

also:

Have you tried

record.AudioSource = 5
or
record.AudioSource = 1


With the sample project I gave you? (don't change the video settings)


I would also try these settings (3,2,1)

record.AudioEncoder = 3 ' try all them

and finally you are using a phone and not the emulator correct?
if you are using a phone, have you downloaded another video
recorded from the market, to see if that one works. so you are
not chasing your tail.
 
Upvote 0
Top