to pause and resume caputured webcam video (Qtmultimedia 5.0-qml-ubuntu) - qt

I am using Qtmultimedia 5.0 to record and capture video from webcam. The example provided by Qt helped me very much. I could record and stop the captured video using the following code.
Camera {
id: camera
}
Rectangle{
Text{
text: qsTr("Record")
}
MouseArea{
onClicked: camera.videoRecorder.record()
}
}
Rectangle{
Text{
text: qsTr("Stop")
}
MouseArea{
onClicked: camera.stop()
}
}
Now i need the pause and resume the webcam video. Is there any function to do that job. If I resume the video it should append to the opened file.

just want to let you know that you can use Qt Media Encoding Library for that task.
It is here - http://kibsoft.ru

Related

How do I determine why the cursor moved in a QML TextField?

I have a QML TextField that I am using with the Qt virtual keyboard to populate text. Occasionally when I am typing fast on the keyboard the cursor will jump unexpectedly to the end of the TextField. Has anyone seen any issues like this? I have ruled out unexpected focus changes as the cause by monitoring OnFocusedChanged while typing. Is there anything else that I might be able to monitor to determine why the cursor is moving to the end?
I am using QT version 5.15 and Virtual Keyboard Version 2.1.
EDIT: Adding code per request
TextField {
id: lotTextField
anchors.left: lotLine.left
anchors.top: lotImg.top
width: commonTextFieldWidth
height: lotImg.height
background: Item {}
text: startingLotCodeText
font.pixelSize: Style._SETTINGS_TEXT_SIZE_3_FONT_PIXEL_SIZE
onPressed: {
lotTextField.forceActiveFocus();
state_proxy.processEvent(EventsQML.EVENT_SHOW_KEYBOARD_REQUEST);
}
onTextEdited: {
state_proxy.checkLotCode(lotTextField.text, false);
}
onEditingFinished: {
state_proxy.checkLotCode(lotTextField.text, true);
scannerTextField.forceActiveFocus();
}
}

QML MediaPlayer H264 not playing but MP4 works

I have a h264/264 file and i am trying to play it in QML like this:
MediaPlayer {
id: mediaplayer
source: "file:///blah.h264"
}
VideoOutput{
id: videoPlayer
anchors.fill: parent
source:mediaplayer
}
MouseArea {
id: playArea
anchors.fill: parent
onPressed: {
console.log("play")
mediaplayer.play()
}
}
it doesn't work. i tried the same but with a .mp4 file that worked but this doesnt.
Also i am using python pyside if that helps...
Most playback engines don’t support raw streams. Put the file in a container. ffmpeg -i blah.264 -codec copy blah.mp4

Connect a slider to control zoom on qml Camera

I am using Camera to take movies.
I want to use a slider to zooming video like zoom of google map.
I've found another Question on SO but the proposed solution works for click whereas I would like to develop a solution for slider.
I wrote code that is not working correctly.
I have not found error, but video size will be very large, then I do not see video.
I try to set digitalZoom for camera but I have this error:
The camera doesn't support zooming. .I know my camera does not support "DigitalZoom" and "OpticalZoom". I want to find a way to zoom in on video taken from camera.
My camera is dino ccd.
Excuse me friends, I can not add comment, I have this error: "You must have 50 reputation to comment".
VideoOutput {
id: viewfinder
source: camera
anchors.fill: parent
focus : true
transform: [
Scale {
id: zoomScale
},
Translate {
id: zoomTranslate
}
]
//Keys.onLeftPressed: viewfinder.seek(viewfinder.position - 5000)
//Keys.onRightPressed: viewfinder.seek(viewfinder.position + 5000)
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.AllButtons
onClicked: {
var zoomIn = mouse.button === Qt.LeftButton;
zoomScale.origin.x = mouse.x;
zoomScale.origin.y = mouse.y;
}
}
Slider {
id:zoomVideo
orientation: Qt.Vertical
minimumValue: 0
maximumValue: 100
stepSize: 10
onValueChanged: {
zoomScale.xScale = zoomVideo.value
zoomScale.yScale = zoomVideo.value
}
}
}
Are you trying to implement a zoom-in/zoom-out functionality using slider just like a normal mobile camera app does, if yes then consider the below untested code snippet because currently I don't have a machine with Qt IDE installed, but it should help you to understand the concept.
Camera {
id: camera
digitalZoom:zoomSlider.value
//if opticalZoom is supported uncomment below line
//opticalZoom:zoomSlider.value
// rest of your settings
}
VideoOutput {
id: viewfinder
source: camera
anchors.fill: parent
focus : true
}
Slider {
id:zoomSlider
orientation: Qt.Vertical
minimumValue: 0
maximumValue: camera.maximumDigitalZoom //or camera.maximumOpticalZoom
stepSize:camera.maximumDigitalZoom/10 // going through 10 steps
value:1.0 // initial zoom level
anchors{
left:parent.left
leftMargin:5
verticalCenter:parent.verticalCenter
}
}
and also I would like you to have a look at the official documentation for these types.Slider, Camera . If you need further clarifications post comments below.

Why QML MediaPlayer/VideoOutput doesn't work for me?

I'm trying to play test video with qml by this code:
import QtQuick 2.2
import QtMultimedia 5.0
Item {
width: 300
height: 300
MediaPlayer {
id: player
source: "C:\\Downloads\\video.mp4"
}
VideoOutput {
id: video
anchors.fill: parent
source: player
}
MouseArea {
anchors.fill: parent
onPressed: player.play()
}
}
But, when I click on view, nothing happens. And if I change onPressed event to something else action (not with the player), it works fine, then it's not a MouseArea problem.
Where did I wrong?
Thank you.
The file path seems to be wrong. Since baclslashes need to be escaped in string litterals, the actual path remaining is:
c:\Downloads\video.mp4
That's a path, but not an URL. The correct URL is (see File URIs in Windows):
file:///C:/Downloads/video.mp4
On your code source:
C:\\Downloads\\video.mp4
should be source:
C://Downloads//video.mp4

How do I remove the BusyIndicator after you read a feed

I have a problem with a BusyIndicator, what happens is that I have appointed BusyIndicator that when loading the feed is removed, but in my file. QML images do not appear in the feed, I wonder if there is any way to tell the BusyIndicator that when the image is displayed BusyIndicator remove.
Well I did this, you can give it a try.
Image
{
id : image1
source:"...your source here"
}
BusyIndicator
{
id:busy1
anchors.centerIn: parent
width:50
height:50
visible: image1.status == Image.Loading
running: image1.status == Image.Loading
}
//indicator only visible and run when image is loading. After image is being loaded or when Image.Ready, the busy indicator will disappear.
You can do something like this
Image{
id:remoteImage
source: "http://www.example.com/m.jpg"
onProgressChanged: {
if(progress==1.0)
busyIndicator.visible=false;
}
}

Resources