New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Watchdog timeout - started happening after i added audio encoding to the video file #1173
Comments
Are you trying to capture sound from the same V4L device that is already in use by motion? |
Yes, and it is capturing and encoding andiu and video, the problem happens when is time to close the file and stop recording... |
Any more info needed? |
I doubt it is possible to use the same V4L device by two different processes. Unless you are using v4l loopback device. You can try that |
movie_extpipe ffmpeg -f alsa -ac 1 -i hw:0 -y -f rawvideo -pix_fmt yuv420p -video_size %wx%h -framerate %fps -i pipe:0 -vcodec mpeg4 -f mp4 %f.mp4 The above extpipe works to record video when motion is detected, while its recording i can enter this: "ffmpeg -f alsa -ac 1 -i hw:0 /mnt/S2Portable/alsaout.wav" int the cli command line and start recording audio from the same device but to a different file with no problem, or i can have the next line also in the config file: "on_movie_start arecord -f S16_LE -r 48000 | lame --preset insane - /mnt/S2Portable/motion/%d%m%Y%H%M%S.mp3" "; on_movie_end pkill -SIGTERM -f "^lame --preset insane - /mnt/S2Portable/motion/%d%m%Y%H%M%S.mp3"" movie_extpipe ffmpeg -f alsa -thread_queue_size 1024 -ac 1 -i hw:0 -y -f rawvideo -video_size %wx%h -framerate %fps -thread_queue_size 1024 -i pipe:0 -vcodec mpeg4 -f mp4 %f.mp4 Like i said, the problem is the watchdog timeout when the event ends, but it works. There if proof of that in the CLI output: Input #0, alsa, from 'hw:0': |
The watchdog timeout happens because the second process locks the V4L device. Try to use v4l loopback device, this should work |
Have you had a chance to try video4linux loopback? |
Actually no, i havent made any more attempts to fix this. I have came across references to that v4l loopback device while i was trying to fix it, but of the top my head i dont actualy know what it is or how to use it. i need to search that to try the solution you sugested, but for now that issue was pushed down on my to do list. But i will get there and i will post my results when i have them. Something that just ocured to me now, you said in a previous post that "the second process locks the V4L device", but if i have motion daemon recording video automaticaly when it is triggered by movement in the image, i can manualy start recording audio from cli using that alsa command i posted, and kill it by pressing ctrl+c, regardless of video capture happening at the moment or not, and i have no issues starting or stopping the audio capture that way. |
I tried to reproduce your issue, but extpipe command fails:
Can you check that you copied the correct command? |
Ok, removed |
|
Motion hangs on
https://github.com/Motion-Project/motion/blob/master/src/event.c#L801 |
The same issue is reproducible if you use this program for extpipe:
|
So, the problem is that |
Example of ffmpeg command that keeps recording audio after the stdin is finished:
|
Greetings! |
I added audio encoding to the out file via the movie_extpipe. everything worked fine when that line was:
movie_extpipe ffmpeg -f rawvideo -pix_fmt yuv420p -video_size %wx%h -framerate %fps -i pipe:0 -vcodec mpeg4 -f mp4 %f.mp4
(video only)
but then i added audio encoding changing extpipe as follows:
movie_extpipe ffmpeg -f alsa -thread_queue_size 1024 -ac 1 -i hw:0 -y -f rawvideo -video_size %wx%h -framerate %fps -thread_queue_size 1024 -i pipe:0 -vcodec mpeg4 -f mp4 %f.mp4
It works, it starts the file when an event is triggered, it encodes audio + video but afer the event_gap + post_capture that i increased to keep the video smooth and the video/audio sync relatively close, when it is suposed to end the video file i get:
motion_watchdog: Thread 1 - Watchdog timeout. Trying to do a graceful restart
motion_watchdog: Thread 1 - Watchdog timeout did NOT restart, killing it!
i believe it keeps encoding audio to the file instead of stopping and closing the file.
I am new to motion and my native language is not English, sorry about possible errors. If anyone needs more information please let me know, i will post as needed.
CLI output_________________________________________________________________________________________________:
AT THIS POINT I PRESSED CTRL + C
LOG file_________________________________________________________________________________________________:
motion.conf file_________________________________________________________________________________________________:
The text was updated successfully, but these errors were encountered: