kpolley / Python_AVrecorder

Simultaneously record audio and video using Python
37 stars 12 forks source link

need some help to start #2

Open fagol opened 5 years ago

fagol commented 5 years ago

Hello, I work with a raspberry too, but i'm a beguinner . how can i do to use yours files, in python 's interface du raspberry ? only copy/paste ? wath is the file : .gitignore, what i do with?

thanks a lot

kpolley commented 4 years ago

Hi,

Try these steps:

  1. Clone the repository git clone https://github.com/kpolley/Python_AVrecorder.git

  2. change your directory cd Python_AVrecorder

  3. Install requirements pip install -r requirements.txt

  4. Run picam.py python3 picam.py

You may run into program issues depending on your hardware. Please feel free to update with any issues and I'll do my best to help out.

P.S: don't worry about the .gitignore file. It's a config file so that github does not push files that are unnecessary for the repository.

fagol commented 4 years ago

Hello, I come back to my project after a year of hiatus. The whole works correctly, but the sound is ahead of the video. How to make this correction. Thanks

fagol commented 4 years ago

small precision: this gap between sound and video begins after approximately 15 seconds. thanks

kpolley commented 4 years ago

I would take a look at the ffmpeg command that is running to further debug...could be that your hardware requires additional parameters.

https://github.com/kpolley/Python_AVrecorder/blob/10134a84fdaeaadcfb1832d35d68e6bf9a58bff3/picam.py#L28

fagol commented 4 years ago

thank you for your feedback. But I'm not sure I understand what you want me to do. maybe it:

Stopping threads... starting mux... ffmpeg version 3.2.14-1~deb9u1+rpt1 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1+deb9u1) 20170516 configuration: --prefix=/usr --extra-version='1~deb9u1+rpt1' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-omx-rpi --enable-mmal --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --arch=armhf --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 34.101 / 55. 34.101 libavcodec 57. 64.101 / 57. 64.101 libavformat 57. 56.101 / 57. 56.101 libavdevice 57. 1.100 / 57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libavresample 3. 1. 0 / 3. 1. 0 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libpostproc 54. 1.100 / 54. 1.100 Guessed Channel Layout for Input Stream #0.0 : mono Input #0, wav, from '/home/pi/video_tmp//10_20_15_12_16.wav': Duration: 00:00:29.41, bitrate: 705 kb/s Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s Input #1, h264, from '/home/pi/video_tmp//10_20_15_12_16.h264': Duration: N/A, bitrate: N/A Stream #1:0: Video: h264 (High), yuv420p(progressive), 1366x768, 25 fps, 25 tbr, 1200k tbn, 50 tbc Output #0, mp4, to '/home/pi/video/10_20_15_12_16.mp4': Metadata: encoder : Lavf57.56.101 Stream #0:0: Video: h264 (High) ([33][0][0][0] / 0x0021), yuv420p(progressive), 1366x768, q=2-31, 25 fps, 25 tbr, 1200k tbn, 1200k tbc Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, mono, fltp, 69 kb/s Metadata: encoder : Lavc57.64.101 aac Stream mapping: Stream #1:0 -> #0:0 (copy) Stream #0:0 -> #0:1 (pcm_s16le (native) -> aac (native)) Press [q] to stop, [?] for help [mp4 @ 0x1c6a2f0] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly frame= 39 fps=0.0 q=-1.0 size= 1109kB time=00:00:01.53 bitrate=5927.3kbits/s speed= 3x
frame= 96 fps= 95 q=-1.0 size= 2906kB time=00:00:03.80 bitrate=6251.7kbits/s speed=3.76x
frame= 166 fps=110 q=-1.0 size= 5142kB time=00:00:06.60 bitrate=6382.4kbits/s speed=4.36x
frame= 234 fps=116 q=-1.0 size= 7380kB time=00:00:09.33 bitrate=6476.8kbits/s speed=4.62x
frame= 311 fps=123 q=-1.0 size= 9948kB time=00:00:12.40 bitrate=6572.1kbits/s speed=4.92x
frame= 386 fps=128 q=-1.0 size= 12458kB time=00:00:15.41 bitrate=6619.1kbits/s speed= 5.1x
frame= 457 fps=129 q=-1.0 size= 14883kB time=00:00:18.25 bitrate=6680.5kbits/s speed=5.14x
frame= 527 fps=129 q=-1.0 size= 17197kB time=00:00:21.04 bitrate=6695.7kbits/s speed=5.15x
frame= 588 fps=128 q=-1.0 size= 19208kB time=00:00:23.49 bitrate=6696.1kbits/s speed=5.12x
frame= 657 fps=129 q=-1.0 size= 21492kB time=00:00:26.24 bitrate=6709.7kbits/s speed=5.15x
frame= 731 fps=130 q=-1.0 size= 23948kB time=00:00:29.21 bitrate=6716.1kbits/s speed=5.21x
frame= 749 fps=132 q=-1.0 Lsize= 24578kB time=00:00:29.92 bitrate=6729.4kbits/s speed=5.25x
video:24306kB audio:253kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.080301% [aac @ 0x18c4890] Qavg: 257.785 done fin result ffmpeg.docx

fagol commented 4 years ago

hi, I continued testing today. My son has just lent me another micro USB and everything is OK. I just did a test on 120s (surroundings) and the video is synchronized with the audio. I am happy, but amazed.