
Recherche avancée
Autres articles (23)
-
Prérequis à l’installation
31 janvier 2010, parPréambule
Cet article n’a pas pour but de détailler les installations de ces logiciels mais plutôt de donner des informations sur leur configuration spécifique.
Avant toute chose SPIPMotion tout comme MediaSPIP est fait pour tourner sur des distributions Linux de type Debian ou dérivées (Ubuntu...). Les documentations de ce site se réfèrent donc à ces distributions. Il est également possible de l’utiliser sur d’autres distributions Linux mais aucune garantie de bon fonctionnement n’est possible.
Il (...) -
L’agrémenter visuellement
10 avril 2011MediaSPIP est basé sur un système de thèmes et de squelettes. Les squelettes définissent le placement des informations dans la page, définissant un usage spécifique de la plateforme, et les thèmes l’habillage graphique général.
Chacun peut proposer un nouveau thème graphique ou un squelette et le mettre à disposition de la communauté. -
À propos des documents
21 juin 2013, parQue faire quand un document ne passe pas en traitement, dont le rendu ne correspond pas aux attentes ?
Document bloqué en file d’attente ?
Voici une liste d’actions ordonnée et empirique possible pour tenter de débloquer la situation : Relancer le traitement du document qui ne passe pas Retenter l’insertion du document sur le site MédiaSPIP Dans le cas d’un média de type video ou audio, retravailler le média produit à l’aide d’un éditeur ou un transcodeur. Convertir le document dans un format (...)
Sur d’autres sites (3710)
-
ffmpeg command not interpreted correctly from cron
16 avril 2022, par Andre Lörchneron my raspberry pi I'm trying to run a script every 30 minutes that restarts a video stream. Reason is the stream is consistently running into hickups after roughly 35 minutes and stops a few minutes after.
I tried fixing the root problem without any success so far, so an easier and valid workaround is to just restart the stream.


I created a script
restart_stream.sh
that kills the previous stream and immediately starts it again.

#!/bin/bash

killall -r libcamera-vid ffmpeg
libcamera-vid -t 0 --framerate 30 --width 1280 --height 720 -b 2000000 -o - --nopreview | ffmpeg -f h264 -thread_queue_size 4096 -i - -f pulse -ar 44100 -ac 2 -acodec pcm_s16le -thread_queue_size 4096 -i default -vcodec copy -acodec aac -ab 128k -fflags genpts -fflags igndts -f fifo -fifo_format flv -map 0:v -map 1:a? -drop_pkts_on_overflow 1 -attempt_recovery 1 -recovery_wait_time 2 rtmp://a.rtmp.youtube.com/live2/<key>
</key>


cron job


*/30 7-19 * * * /bin/restart_stream.sh >/tmp/stream.log 2>&1



Running this script manually from the ssh console works perfectly fine but once I run it from cron it fails with the following error


[1:41:01.657471459] [2138] INFO RPI raspberrypi.cpp:1326 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unic>
[1:41:01.658232799] [2136] INFO Camera camera.cpp:1028 configuring streams: (0) 1280x720-YUV420
[1:41:01.659060988] [2138] INFO RPI raspberrypi.cpp:747 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor >
[1:41:01.698525343] [2145] INFO IPARPI raspberrypi.cpp:626 Request ctrl: Saturation = 1.000000
[1:41:01.698798789] [2145] INFO IPARPI raspberrypi.cpp:626 Request ctrl: Contrast = 1.000000
[1:41:01.698840990] [2145] INFO IPARPI raspberrypi.cpp:626 Request ctrl: Brightness = 0.000000
[1:41:01.698877617] [2145] INFO IPARPI raspberrypi.cpp:626 Request ctrl: AwbMode = 0
[1:41:01.698910745] [2145] INFO IPARPI raspberrypi.cpp:626 Request ctrl: Sharpness = 1.000000
[1:41:01.698947187] [2145] INFO IPARPI raspberrypi.cpp:626 Request ctrl: ExposureValue = 0.000000
[1:41:01.698983203] [2145] INFO IPARPI raspberrypi.cpp:626 Request ctrl: AeExposureMode = 0
[1:41:01.699014646] [2145] INFO IPARPI raspberrypi.cpp:626 Request ctrl: FrameDurationLimits = [ 33333, 33333 ]
[1:41:01.699050903] [2145] INFO IPARPI raspberrypi.cpp:626 Request ctrl: AeMeteringMode = 0
[1:41:01.699082938] [2145] INFO IPARPI raspberrypi.cpp:626 Request ctrl: NoiseReductionMode = 1
ffmpeg version 4.3.3-0+rpt2+deb11u1 Copyright (c) 2000-2021 the FFmpeg developers
 built with gcc 10 (Raspbian 10.2.1-6+rpi1)
 configuration: --prefix=/usr --extra-version=0+rpt2+deb11u1 --toolchain=hardened --incdir=/usr/include/arm-linux-gn>
 WARNING: library configuration mismatch
 avutil configuration: --prefix=/usr --extra-version=0+rpt2+deb11u1 --toolchain=hardened --incdir=/usr/include/>
 avcodec configuration: --prefix=/usr --extra-version=0+rpt2+deb11u1 --toolchain=hardened --incdir=/usr/include/>
 avformat configuration: --prefix=/usr --extra-version=0+rpt2+deb11u1 --toolchain=hardened --incdir=/usr/include/>
 avdevice configuration: --prefix=/usr --extra-version=0+rpt2+deb11u1 --toolchain=hardened --incdir=/usr/include/>
 avfilter configuration: --prefix=/usr --extra-version=0+rpt2+deb11u1 --toolchain=hardened --incdir=/usr/include/>
 avresample configuration: --prefix=/usr --extra-version=0+rpt2+deb11u1 --toolchain=hardened --incdir=/usr/include/>
 swscale configuration: --prefix=/usr --extra-version=0+rpt2+deb11u1 --toolchain=hardened --incdir=/usr/include/>
 swresample configuration: --prefix=/usr --extra-version=0+rpt2+deb11u1 --toolchain=hardened --incdir=/usr/include/>
 postproc configuration: --prefix=/usr --extra-version=0+rpt2+deb11u1 --toolchain=hardened --incdir=/usr/include/>
 libavutil 56. 51.100 / 56. 51.100
 libavcodec 58. 91.100 / 58. 91.100
 libavformat 58. 45.100 / 58. 45.100
 libavdevice 58. 10.100 / 58. 10.100
 libavfilter 7. 85.100 / 7. 85.100
 libavresample 4. 0. 0 / 4. 0. 0
 libswscale 5. 7.100 / 5. 7.100
 libswresample 3. 7.100 / 3. 7.100
 libpostproc 55. 7.100 / 55. 7.100
Input #0, h264, from 'pipe:':
 Duration: N/A, bitrate: N/A
 Stream #0:0: Video: h264 (High), yuv420p(progressive), 1280x720, 30 fps, 30 tbr, 1200k tbn, 60 tbc
default: No such process



It seems to interpret the command differently and not treat
default
within the ffmpeg call as a parameter.

-
ffmpeg command not interpreted correcly from cron
16 avril 2022, par Andre Lörchneron my raspberry pi I'm trying to run a script every 30 minutes that restarts a video stream. Reason is the stream is consistently running into hickups after roughly 35 minutes and stops a few minutes after.
I tried fixing the root problem without any success so far, so an easier and valid workaround is to just restart the stream.


I created a script
restart_stream.sh
that kills the previous stream and immediately starts it again.

#!/bin/bash

killall -r libcamera-vid ffmpeg
libcamera-vid -t 0 --framerate 30 --width 1280 --height 720 -b 2000000 -o - --nopreview | ffmpeg -f h264 -thread_queue_size 4096 -i - -f pulse -ar 44100 -ac 2 -acodec pcm_s16le -thread_queue_size 4096 -i default -vcodec copy -acodec aac -ab 128k -fflags genpts -fflags igndts -f fifo -fifo_format flv -map 0:v -map 1:a? -drop_pkts_on_overflow 1 -attempt_recovery 1 -recovery_wait_time 2 rtmp://a.rtmp.youtube.com/live2/<key>
</key>


cron job


*/30 7-19 * * * /bin/restart_stream.sh >/tmp/stream.log 2>&1



Running this script manually from the ssh console works perfectly fine but once I run it from cron it fails with the following error


[1:41:01.657471459] [2138] INFO RPI raspberrypi.cpp:1326 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unic>
[1:41:01.658232799] [2136] INFO Camera camera.cpp:1028 configuring streams: (0) 1280x720-YUV420
[1:41:01.659060988] [2138] INFO RPI raspberrypi.cpp:747 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor >
[1:41:01.698525343] [2145] INFO IPARPI raspberrypi.cpp:626 Request ctrl: Saturation = 1.000000
[1:41:01.698798789] [2145] INFO IPARPI raspberrypi.cpp:626 Request ctrl: Contrast = 1.000000
[1:41:01.698840990] [2145] INFO IPARPI raspberrypi.cpp:626 Request ctrl: Brightness = 0.000000
[1:41:01.698877617] [2145] INFO IPARPI raspberrypi.cpp:626 Request ctrl: AwbMode = 0
[1:41:01.698910745] [2145] INFO IPARPI raspberrypi.cpp:626 Request ctrl: Sharpness = 1.000000
[1:41:01.698947187] [2145] INFO IPARPI raspberrypi.cpp:626 Request ctrl: ExposureValue = 0.000000
[1:41:01.698983203] [2145] INFO IPARPI raspberrypi.cpp:626 Request ctrl: AeExposureMode = 0
[1:41:01.699014646] [2145] INFO IPARPI raspberrypi.cpp:626 Request ctrl: FrameDurationLimits = [ 33333, 33333 ]
[1:41:01.699050903] [2145] INFO IPARPI raspberrypi.cpp:626 Request ctrl: AeMeteringMode = 0
[1:41:01.699082938] [2145] INFO IPARPI raspberrypi.cpp:626 Request ctrl: NoiseReductionMode = 1
ffmpeg version 4.3.3-0+rpt2+deb11u1 Copyright (c) 2000-2021 the FFmpeg developers
 built with gcc 10 (Raspbian 10.2.1-6+rpi1)
 configuration: --prefix=/usr --extra-version=0+rpt2+deb11u1 --toolchain=hardened --incdir=/usr/include/arm-linux-gn>
 WARNING: library configuration mismatch
 avutil configuration: --prefix=/usr --extra-version=0+rpt2+deb11u1 --toolchain=hardened --incdir=/usr/include/>
 avcodec configuration: --prefix=/usr --extra-version=0+rpt2+deb11u1 --toolchain=hardened --incdir=/usr/include/>
 avformat configuration: --prefix=/usr --extra-version=0+rpt2+deb11u1 --toolchain=hardened --incdir=/usr/include/>
 avdevice configuration: --prefix=/usr --extra-version=0+rpt2+deb11u1 --toolchain=hardened --incdir=/usr/include/>
 avfilter configuration: --prefix=/usr --extra-version=0+rpt2+deb11u1 --toolchain=hardened --incdir=/usr/include/>
 avresample configuration: --prefix=/usr --extra-version=0+rpt2+deb11u1 --toolchain=hardened --incdir=/usr/include/>
 swscale configuration: --prefix=/usr --extra-version=0+rpt2+deb11u1 --toolchain=hardened --incdir=/usr/include/>
 swresample configuration: --prefix=/usr --extra-version=0+rpt2+deb11u1 --toolchain=hardened --incdir=/usr/include/>
 postproc configuration: --prefix=/usr --extra-version=0+rpt2+deb11u1 --toolchain=hardened --incdir=/usr/include/>
 libavutil 56. 51.100 / 56. 51.100
 libavcodec 58. 91.100 / 58. 91.100
 libavformat 58. 45.100 / 58. 45.100
 libavdevice 58. 10.100 / 58. 10.100
 libavfilter 7. 85.100 / 7. 85.100
 libavresample 4. 0. 0 / 4. 0. 0
 libswscale 5. 7.100 / 5. 7.100
 libswresample 3. 7.100 / 3. 7.100
 libpostproc 55. 7.100 / 55. 7.100
Input #0, h264, from 'pipe:':
 Duration: N/A, bitrate: N/A
 Stream #0:0: Video: h264 (High), yuv420p(progressive), 1280x720, 30 fps, 30 tbr, 1200k tbn, 60 tbc
default: No such process



It seems to interpret the command differently and not treat
default
within the ffmpeg call as a parameter.

-
Cross Fade Arbitrary Number of Videos ffmpeg Efficiently
15 avril 2022, par jippyjoe4I have a series of videos named 'cut_xxx.mp4' where xxx represents a number 000 through 999. I want to do a cross fade on an arbitrary number of them to create a compilation, and each fade should last 4 seconds long. Currently, I'm doing this with Python, but I suspect this is not the most efficient way :


import subprocess 
def get_length(filename):
 result = subprocess.run(["ffprobe", "-v", "error", "-show_entries",
 "format=duration", "-of",
 "default=noprint_wrappers=1:nokey=1", filename],
 stdout=subprocess.PIPE,
 stderr=subprocess.STDOUT)
 return float(result.stdout)

CROSS_FADE_DURATION = 4

basevideo = 'cut_000.mp4'
for ii in range(total_videos - 1):
 fade_start = math.floor(get_length(basevideo) - CROSS_FADE_DURATION) # new one
 outfile = f'cross_fade_{ii}.mp4'
 append_video = f'cut_{str(ii+1).zfill(3)}.mp4'
 cfcmd = f'ffmpeg -y -i {basevideo} -i {append_video} -filter_complex "xfade=offset={fade_start}:duration={CROSS_FADE_DURATION}" -an {outfile}'
 basevideo = outfile
 subprocess.call(cfcmd)
 print(fade_start)



I specifically remove the audio with
-an
because I'll add an audio track later. The issue I see here is that I'm compressing the video over and over again with each individual video file I add to the compilation because I'm only adding one video at a time and then re-encoding.

There should be a way to cross fade multiple videos together into a compilation, but I'm not sure what this would look like or how I would get it to work for an arbitrary number of video files of different durations. Any idea on what that monolithic ffmppeg command would look like or how I could automatically generate it given a list of videos and their durations ?