I have org.webrtc.VideoFrame
frames stream.
The frames are coming one by one. Is there any lib or tool to convert frames to stream on a fly?
I could successfully take convert that VideoFrames to array of bytes. (similar as this question that uses it for image) Android org.webrtc.VideoRenderer.I420Frame arrays to PreviewCallback.onPreviewFrame byte[]
I would like to create playable stream video but when I try to play the one create with FileOutputStream
or any other stream that can be passed to FFMPEG for example it is not playable, so seems it needs muxer to create it?
private fun addMetaDataToVideo() {
val file = File(context.getExternalFilesDir(Environment.DIRECTORY_DCIM).toString() + "/"
+"KYR", "${videoNamePrefix}}.mp4")
val out = FileOutputStream(file)
listOfFrames.forEach { out.write(it) }
out.close()
addMetaDataToVideo(file)
}
private fun addMetaDataToVideo(videoFile: File) {
val values = ContentValues(3)
values.put(MediaStore.Video.Media.MIME_TYPE, "video/mp4")
// values.put(MediaStore.Video.Media.DURATION, getVideoDuration(videoFile))
values.put(MediaStore.Video.Media.DATA, videoFile.absolutePath)
context.contentResolver.insert(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, values)
}