Is a webcam feed inside of emacs possible? - emacs

I want to live stream me coding on TwitchTV. Back in my vim days, I would open up several terminals and leave a small hole in the corner to put a quicktime webcam display so that my screen recorder would capture my face. What I would like is the ability to embed a webcam feed into a buffer of emacs so that it will be integrated with emacs tiling ability. Is this possible? If so, how would I go about doing it?

Take my answer with a grain of salt, it's untested and I'm not sure if it works, and it certainly won't do audio.
Create a live-streaming .gif file from your video stream:
git clone https://github.com/jbochi/gifstreaming
cd gifstreaming
mkdir input
mkdir parts
ffmpeg -re -i rtmp:///dev/video0 -pix_fmt pal8 -s 159x97 -r 10 input/in%d.gif &
python transform.py
node server.js
https://github.com/jbochi/gifstreaming
Open a buffer with the image displayed inline using the emacs web browser:
M-x eww RET http://localhost:8080/ RET
Alternatively, you could try streaming directly from your webcam without the gif step, but I doubt eww can display video files inline.
http://www.area536.com/projects/streaming-video/

Related

ffmpeg - different video and audio length synchronization

I have a task where the sound is longer and the image should come later.
Actually, this is exactly what I want, but it's a bit different: ffmpeg : mix audio and video of different length
First of all, I leave the picture I draw below to be understood.
Click to see the image.
By doing this I am thinking of catching sync. With which ffmpeg command can I do this?
Thank you.
I had to use offset.
I solved it this way. I will automatically add the corresponding time interval according to the difference between video and audio. I will use the programming language for this.
ffmpeg -i finalsound.flv -itsoffset 00:00:44 -i finalvideo.flv -c copy final.flv
Thank you.

VLC loop/repeat not seamless when running in remote command mode

I have a Raspberry Pi 4 running Raspbian and run VLC from a command prompt with the following parameters
vlc --intf rc --rc-host localhost:65513 --fullscreen
I have successfully gotten VLC to play a video by issuing remote commands through a Socket and have issued a repeat/loop command.
The looping doesn't have to be seamless but it momentarily cuts back to the command prompt before it replays the video and looks unprofessional.
Is there any solution to this? I cannot find anything that works. I can live with the screen staying black for a moment but can't have work presentations playing continously on a screen that shows Linux in the background every 30 seconds.
I had the same issue, here is how I "fixed it" :
set desktop background to a black jpeg.
Told the panel not to appear at launch by editing /home/pi/.config/lxsession/LXDE-pi/autostart as follow (first line that launchs the panel is commented to do so) :
##lxpanel --profile LXDE-pi
#pcmanfm --desktop --profile LXDE-pi
#xscreensaver -no -splash
Prevent the pi to blank screen or go to sleep by editing file /etc/lightdm/lightdm.conf and adding in the [SeatDefaults] section :
xserver-command=X -s 0 -dpms
Now when VLC is looping, it still cuts back to the desktop but as everything is blacked out (no panel, black background), the cut becomes invisible.
Et voilà :)
My best.
S.Y.
I solved this by using two instances of VLC, whereby one instance streams the video to the other using the --sout-keep flag. This way the VLC instance actually producing an image shows a continuous stream, as the streaming instance tries to keep one stream instance open across multiple(or one looped) file.
For example:
vlc rtp://127.0.0.1 --intf dummy --fullscreen --no-video-title-show --alsa-audio-device hw:1,0 &
cvlc file.mp4 --sout "#rtp{mux=ts,dst=127.0.0.1,sdp=sap,name='somename'}" --sout-keep --loop
The same happened to me some month ago, it looks that the only one solution is to wait for the release of vlc 4.0 for raspbian too, and no plans about it.

Why can’t VLC go in to fullscreen mode?

I’m working on a Matlab application that uses a VLC class to control a VLC-instance. One of the features is to set the VLC player to fullscreen. This feature works perfectly fine.
The VLC player is downloaded from Matlab’s File Exchange: https://se.mathworks.com/matlabcentral/fileexchange/56215-vlc (Thanks a lot Léa Strobino)
However, one particular clip insists on resizing the player to a smaller size.
I have done some research and it turns out that this is a common problem in some VLC versions.
Normal workarounds are to uncheck the “adapt interface to video size” (something like that) and to check the “Fullscreen” box.
This ought to make the player open in fullscreen and not resize the screen to video size. The video still resizes the player to a smaller size.
All the specs of the clips are the same: Same file extension (.vob), formats and were made the same way (I did some video trimming and such using ffmpeg – but the same way every time).
I have noticed one difference and that is that this particular video has a lower Data and bitrate (~1000-1500kbps) where as the others are higher (<4000kbps). Also when showing the properties of the clip the frame height and width are blank as opposed to the others that have specific values.
This should however not have an effect of the fullscreen command from Matlab called after loading the video into the playlist. The command has no effect on this video, but does on all other.
It is possible to set the player to fullscreen manually by clicking the window, so it is not caused by some restriction in the video not allowing it to fullscreen.
Why does the video refuse to go in to fullscreen?
Hope somebody is able to help.
Okay so I seem to have solved the problem now. Without being completely sure why - the problem was in the lowered data/framerate.
I tried to add -crf 18 when converting my .mp4 to a .vob file:
ffmpeg -i input.mp4 -vcodec copy -acodec ac3 -crf 18 output.vob
The -crf stands for Constant Rate Factor and is a way to ensure a specific Data rate. The values goes from 0-51 and 18 seems to be the lowest 'sane' value (highest data rate). A good explanation can be found here: https://superuser.com/questions/677576/what-is-crf-used-for-in-ffmpeg
With this higher data rate the video opens up in fullscreen everytime :=)

how to convert MID file to wav file?

I want to play background music in my game application using AVAudio player.I am using .MDI file.This file is not playing in AVAudio player.So i want to convert this .MDi file to wav file.IS it possible?
Yes, it is possible. Assuming you're trying to convert it on a Mac the following steps will result in a MIDI file being converted to a WAV file (should also work on PC's and Linux O/S's).
Download and install Audacity
Once Audacity has been downloaded and installed (launch Audacity)
Open your MIDI file that you want to convert to WAV (don't play it yet though). Quicktime Player should be fine
Back in the Audacity application, press the Record button (red circle), you should see a recording take place, play your MIDI file that's opened in the Quicktime Player.
Once the MIDI file in Quicktime Player has stopped, press the stop button (yellow square)
Go to File -> Export As WAV... And save your file
That's it!!! You should now have file that is in a WAV file format :-)
If you have problems with the following just post a comment, and I'll try and help you out.
Good luck!!!
Take a look at TiMidity++

SoundManager + FFMPEG causing loud popping sound when streaming MP3s?

I built an application that plays both uploaded original mp3 files, and copies that have been converted with FFMPEG. I am finding that in some cases the FFMPEG files have a horrible popping/clicking/screeching sound for a split second at startup (hear below). But when I analyze the file in an audio editor there is nothing there, so it seems to be either the browser or soundManager reacting badly to something in that file. Wondering if there is any way I can fix this either by adjusting FFMPEG settings, soundManager settings, or..... Any suggestions?
I've uploaded the offending sound in the link below (before the music starts playing).
Hear sound
Screeching/clicking at the beginning often points to a badly formed mp3 file. (There are a lot of them in the wild.)
Try checking both the original and converted files with mp3check -e -B
If you get errors, adding mp3check --cut-junk-start to your pipline should work.