OK after updating your requirements I guess the following can help
first you create a program that prepare the frames
Mat frame = imread('<file>');
std::vector<uchar> buff;
cv::imencode(".jpg", frame, buff);
for (auto i = buff.begin(); i != buff.end(); ++i)
std::cout << *i ;
then you can use v4l2loopback
combined with ffmpeg
to emulate the webcam and pipe the output from the above program
./app | ffmpeg -re -i pipe:0 -f v4l2 /dev/video1
now the /dev/video1
is a virtual webcam (video device). Note that is not USB output. But I hope that's what you want.
For further info you can check this and this
UPDATE
you can always create another program that capture the output from /dev/video1
and then uses libusb
to write it to another USB port which will achieve what do you want (webcam output to usb port
check this for an example