ceturtdiena, 2022. gada 27. janvāris

extract frames from video and create video from frames using ffmpeg (whole tutorial later)

 ffmpeg -i kickflip.mp4 '%04d.png'


for 60 fps video

ffmpeg -framerate 60 -pattern_type glob -i '*.png'   -c:v libx264 -pix_fmt yuv420p result4.mp4


pirmdiena, 2022. gada 3. janvāris

How to mount external hard drive EXT4 to ubuntu linux?

open nautilus check if drive appears - if it appears it has number like 68fdbd51-a4d0-4e10-b665-156f40dc2a86

check mounted devices - lsblk 

check fstab cat /etc/fstab

(replace username with Your system username)

sudo chown -R $USER:$USER /media/username/68fdbd51-a4d0-4e10-b665-156f40dc2a86

sudo chmod -R 777 /media/username/68fdbd51-a4d0-4e10-b665-156f40dc2a86



ceturtdiena, 2021. gada 23. decembris

Updated

 https://mytechservinginternetmeals.blogspot.com/2021/10/how-to-start-making-browser-video-game.html

more updated -- I'm creating 3d skatepark copy, my work here - https://drive.google.com/file/d/1ubGOpjX6iTFSM6sqyeyg6N8JndwVKoew/view?usp=sharing https://ibb.co/b1HTJtG

https://drive.google.com/file/d/1SaugQ4imeCVrizkRu2vyTaUjzYkUDvkf/view?usp=sharing


https://drive.google.com/file/d/18IAE1ySlamVVxCYy94D5-D2T__V4FqEM/view?usp=sharing
 

raw drafts -- 

pool- 
https://drive.google.com/file/d/1lEvx78VK3EqxbN30GE4vigPb-_SxHs7E/view?usp=sharing
 


FUNBOX - 
https://drive.google.com/file/d/172i1mAB5ZubMw_zN0SsnnQFwUVcKVzLZ/view?usp=sharing


spine - https://drive.google.com/file/d/1qZpKA2ZSYj_atAiK24ACm5l2Xe2n06jY/view?usp=sharing

corner - https://drive.google.com/file/d/1iDa4WUwrPKD8P5ZkjW8mnYPWQkTDXLnk/view?usp=sharing

bank 1 - https://drive.google.com/file/d/1d0IWoOuVrdP92GC9RU6U46cannzH-JgV/view?usp=sharing

bank 2 - https://drive.google.com/file/d/1QJYyIoB_eDm09NOvxnq_MXLLBFyCxM7i/view?usp=sharing

piektdiena, 2021. gada 5. novembris

VIDEO EDITOR CONSOLE. *PSEUDO* CODE. (NOT FINISHED - MIGHT WORK!!)

IF YOU ALWAYS WANTED VIDEO EDITOR THAT JUST TRIMS AND MERGES CLIPS BASED ON CONSOLE INPUT - HERE IS THE C++ VERSION SOURCE CODE.
HOW TO COMPILE? INSTALL g++ AND ffmpeg (CODE IS FOR LINUX SO FAR!!!)
sudo apt install g++
then create new file editor.cpp
compile the file from command line -
g++ -std=c++17 editor.cpp -o editor

copy binary (editor) to /home/ and run the binary ./editor





#include <string>
#include <iostream>
#include <fstream>
#include <filesystem>
#include <algorithm>
#include <unistd.h>

//g++ -std=c++17 editor.cpp -o editor
namespace fs = std::filesystem;
bool in_array(const std::string & value,
  const std::vector < std::string > & array) {
  return std::find(array.begin(), array.end(), value) != array.end();
}
int main() {
//get username 
    std::string Username = getlogin();
//opens file list
  system((std::string("cat /home/") + Username + std::string("/renders/mylist.txt")).c_str());

//asks which folder should program choose
  std::string mape;
  std::cout << "Kura mape?" << "!\n";
  std::cin >> mape;
//asks which file name should final render choose
  std::cout << "Final faila nosaukums? !\n";
  std::string finalnosaukums;
  std::cin >> finalnosaukums;
  std::string path = "/home/" + Username + mape;
  std::vector < std::string > arr;

int guesses = 0;





//counts how many files are in choosed directory
auto dirIter = std::filesystem::directory_iterator(mape);
int fileCount = 0;
for (auto& entry : dirIter)
{
    if (entry.is_regular_file())
    {
        ++fileCount;
    }
}





  for (const auto & entry: fs::directory_iterator(path)) {
    std::string name;
    std::cout << "Kurais video? !\n";
    std::cout << entry.path() << std::endl;
    std::cin >> name;
    if (in_array(name, arr)) {
      //std::cerr << "Found at position " << std::distance(std::array, foo) << endl;
      std::cout << "Kurais video? !\n";
      std::cin >> name;
      std::cout << "Masīva garums. jeb cik video jau pievienoti:" << sizeof(arr) << "!\n";
      std::cout << entry.path() << std::endl;
    } else {
      std::cout << "Not found" << std::endl;
      arr.push_back(name);
    }
    std::cout << entry.path() << name << "!\n";
  }
  for (const auto & entry2: fs::directory_iterator(path)) {
    guesses++;

    std::string name2;
    std::cout << "Kurais video?" << name2 << "!\n";
    std::cout << entry2.path() << std::endl;
    std::cin >> name2;
    if (in_array(name2, arr)) {
      //std::cerr << "Found at position " << std::distance(garumi, foo) << endl;
      std::cout << "Kurais video?" << name2 << "!\n";
      std::cin >> name2;
      //std::cout << "Masīva garums. jeb cik video jau pievienoti:" << size << "!\n";
      std::cout << entry2.path() << std::endl;
    } else {
      std::cout << "Not found" << std::endl;
      if (in_array(name2, arr)) {
        system("ffprobe -i name2 -show_entries format=duration -v quiet -of csv='p=0'");
        int vienav = system("ffprobe -i name2 -show_entries format=duration -v quiet -of csv='p=0'");
        std::cout << "No kuras sekundes sākt? !\n";
        int sakums;
        std::cin >> sakums;
        std::cout << "No kuras sekundes beigt? !\n";
        int beigas;
        std::cin >> beigas;
        if (vienav > beigas) {
          system((std::string("ffmpeg -i name2 -ss") + std::to_string(sakums) + std::string("to") + std::to_string(beigas) + std::string("-c:v libx264 -crf 30 trim_opseek") + name2).c_str());
        } else {
          system("ffprobe -i name2 -show_entries format=duration -v quiet -of csv='p=0'");
          std::cout << "PARSNIEDZI LIMITU ... No kuras sekundes beigt" << beigas << "!\n";
        }
      }
    }
    std::cout << entry2.path() << name2 << "!\n";
  }





if(fileCount === guesses){


  system((std::string("ffmpeg -f concat -safe 0 -i mylist.txt -c copy /home/") + Username + std::string("/renders"), finalnosaukums).c_str());


}


}


svētdiena, 2021. gada 24. oktobris

HOW TO START MAKING BROWSER VIDEO GAME WITH PREMADE GAME CODE? (STARTING POINT FAST, NOT FOR COMPUTER ILLITERATES)

https://drive.google.com/file/d/1Pd3KgXuSVoOFuxyliYjS3RoYb6mvnM28/view?usp=sharing -- THIS IS GAME CLIENT, IT SHOULD BE HOSTED AS ANY WEBSITE, WITH SERVER SETTINGS WHERE (CORS) IS ENABLED. (Apache2 module). To use this, You should be able to install any webserver (python, apache2, nginx etc). SO LINUX KNOWLEDGE IS A MUST MOST LIKELY. 



 THE ORIGINAL GAME CLIENT CODE CAN BE DOWNLOADED HERE - https://github.com/lv88h/Quick_3D_MMORPG 


 ALSO, THERE GAME SERVER CODE, WHICH CAN BE DOWNLOADED HERE (SAME LINK)- https://github.com/lv88h/Quick_3D_MMORPG 



 IN ORDER TO MAKE SERVER WORK, YOU SHOULD BE ABLE TO INSTALL NODE.JS and start the server on 3000 port, by typing in terminal node index.mjs.



 You should be able to close the ports and kill server application afterwards.

sudo netstat -ltup   | open ports
sudo ufw allow 3000/tcp  | open port
lsof -i tcp:3000 | find process on the port
kill -9 PID | kill the process

 More about the way to develop game: Since, this is game based on 3d game engine for web browsers called three.js, You will have to be able to program in javascript, which will be the main point. For example, opening /src/scenerycontroller.js and editing constants that I made to add 3d objects in ordinary coordinates, is a must. 


That's only beginning, since I haven't developed physics to these objects or any other step. Second, once You get basic coding done for physics, You will need a lot of 3d object files in .fbx and .glb files, which can be found in /resources/ folder. 


What You will need to know is 3d design using software like Blender or others. There are animations, which are defined in code and also found in these 3d files, so this is basically, biggest step in this kind of game making. 


 If You have way better way to develop a browser game, or 3d game in general, please contact me @ r.mazitis@gmail.com.

trešdiena, 2021. gada 22. septembris

HOW TO SCREEN RECORD UBUNTU?

If ffmpeg -encoders |grep h264 output NVIDIA HVEC somewhere there, ubuntu uses hardware encoding by default.

ffmpeg -f x11grab -video_size 1920x1080 -framerate 60 -i :1 -v verbose -f pulse -i default -vf format=yuv420p output.mp4



ffmpeg -f x11grab -video_size 1920x1080 -framerate 60 -i :0 -v verbose -f pulse -i default -vf format=yuv420p output.mp4



crtl-c - to finish