
Recherche avancée
Autres articles (43)
-
Submit enhancements and plugins
13 avril 2011If you have developed a new extension to add one or more useful features to MediaSPIP, let us know and its integration into the core MedisSPIP functionality will be considered.
You can use the development discussion list to request for help with creating a plugin. As MediaSPIP is based on SPIP - or you can use the SPIP discussion list SPIP-Zone. -
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
Librairies et binaires spécifiques au traitement vidéo et sonore
31 janvier 2010, parLes logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
Binaires complémentaires et facultatifs flvtool2 : (...)
Sur d’autres sites (5689)
-
Artifacts in ffmpeg fifo, low fps, stream ends
11 août 2020, par Ben GardnerI'm using a Raspberry Pi 3B and 4 for this, neither works.


I'm trying to both pass my capture card's input (
/dev/video0
) through a fifo file so I can play it on the screen via omxplayer (1080p/30fps), and also grab frames of/dev/video0
out to a series of jpgs (1920x1080 right now, but I'd like it to be 640x480) so I can do analysis on it while it's being played. The input to the capture card is television via HDMI.

This is the command I use to make the stream go to the fifo and jpgs.


ffmpeg -y -f v4l2 -input_format mjpeg -framerate 30 -video_size 1920x1080 \
-thread_queue_size 16384 -i /dev/video0 -f alsa -ac 1 \
-thread_queue_size 16384 -i hw:CARD=U0x534d0x2109,DEV=0 \
-c:v copy -b:v 32000k -preset faster -x264opts keyint=50 \
-g 25 -pix_fmt yuvj422p -c:a aac -b:a 128k -codec:v copy -f tee \
-map 0:v -map 1:a "fifo.mkv|output_%3d.jpg"



Here is my output, which gives me 30fps originally, sometimes dipping into 29-28 fps, and then skipping (both audio and video) and artifacts in the video after around 5-10 minutes with the severity eventually increasing until it stops :


[mjpeg @ 0x1504490] EOI missing, emulating
Input #0, video4linux2,v4l2, from '/dev/video0':
 Duration: N/A, start: 27151.039849, bitrate: N/A
 Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for Input Stream #1.0 : mono
Input #1, alsa, from 'hw:CARD=U0x534d0x2109,DEV=0':
 Duration: N/A, start: 1596773777.825328, bitrate: 1536 kb/s
 Stream #1:0: Audio: pcm_s16le, 96000 Hz, mono, s16, 1536 kb/s
Stream mapping:
 Stream #0:0 -> #0:0 (copy)
 Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, tee, to 'fifo.mkv|output_%3d.jpg':
 Metadata:
 encoder : Lavf58.20.100
 Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080, q=2-31, 32000 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
 Stream #0:1: Audio: aac (LC), 96000 Hz, mono, fltp, 128 kb/s
 Metadata:
 encoder : Lavc58.35.100 aac
[alsa @ 0x1507300] Thread message queue blocking; consider raising the thread_queue_size option (current value: 16384)
[alsa @ 0x1507300] ALSA buffer xrun.time=00:13:55.89 bitrate=N/A speed=0.972x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:14:16.02 bitrate=N/A speed=0.974x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:14:27.25 bitrate=N/A speed=0.972x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:14:33.35 bitrate=N/A speed=0.97x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:14:44.71 bitrate=N/A speed=0.969x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:14:49.71 bitrate=N/A speed=0.97x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:15:01.51 bitrate=N/A speed=0.967x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:15:07.78 bitrate=N/A speed=0.969x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:15:14.27 bitrate=N/A speed=0.962x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:15:26.44 bitrate=N/A speed=0.96x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:15:32.40 bitrate=N/A speed=0.96x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:15:38.63 bitrate=N/A speed=0.963x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:15:45.60 bitrate=N/A speed=0.959x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:15:50.93 bitrate=N/A speed=0.957x
 Last message repeated 1 times
[alsa @ 0x1507300] ALSA buffer xrun.time=00:16:00.79 bitrate=N/A speed=0.951x
 Last message repeated 1 times
[alsa @ 0x1507300] ALSA buffer xrun.time=00:16:05.29 bitrate=N/A speed=0.949x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:16:07.19 bitrate=N/A speed=0.949x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:16:11.72 bitrate=N/A speed=0.945x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:16:16.02 bitrate=N/A speed=0.944x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:16:26.39 bitrate=N/A speed=0.953x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:16:30.22 bitrate=N/A speed=0.938x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:16:30.98 bitrate=N/A speed=0.937x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:16:37.66 bitrate=N/A speed=0.941x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:16:41.28 bitrate=N/A speed=0.935x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:16:42.95 bitrate=N/A speed=0.934x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:16:45.82 bitrate=N/A speed=0.933x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:16:46.76 bitrate=N/A speed=0.932x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:16:47.05 bitrate=N/A speed=0.931x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:16:50.74 bitrate=N/A speed=0.927x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:16:57.05 bitrate=N/A speed=0.927x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:16:58.91 bitrate=N/A speed=0.927x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:17:09.41 bitrate=N/A speed=0.92x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:17:12.04 bitrate=N/A speed=0.917x
[alsa @ 0x1507300] ALSA buffer xrun.time=00:17:12.61 bitrate=N/A speed=0.916x
Killed31579 fps= 28 q=-1.0 size=N/A time=00:17:32.56 bitrate=N/A speed=0.919x



I also occasionally get this error :


[tee @ 0x17001c0] Non-monotonous DTS in output stream 0:1; previous: 99251754, current: 99247503; changing to 99251755. This may result in incorrect timestamps in the output file.



I'm assuming this has something to do with the audio getting routed to the jpg. I've tried
[select=\'v\']
in front of the jpg, which doesn't change the behavior as well as[map=\'1\:a\']
in front of the mkv, which says[matroska @ 0xe446f0] Unknown option 'map'
.

I should also disclaim that I don't have much of an idea of what this command is doing compression-wise, I basically just copy/pasted that part.


What edits do I need to make to get this into a fifo and series of jpgs at the same time ?


-
Python and ffmpeg audio sync and screen recording issues
9 août 2020, par odddollarI'm using ffmpeg and python to record my desktop screen. When the program is run, it starts recording, then when I press a key-combo it cuts off the last x amount of seconds and saves it then starts recording again ; similar to the "record that" functionality of windows game bar.


I have it working so it records video just fine, but then I change the ffmpeg command to record audio from my desktop and I get an error saying
ValueError: could not convert string to float: 'N/A'
occurring when I try to calculate the length of the recorded video. It appears as though the recording isn't being stopped until after I try to calculate the video length, even though this exact same code works fine when not recording audio.

Additionally, I also have an issue when recording audio in that the audio is a couple hundred milliseconds in front of the video. It's not a lot but it's enough to be noticeable.


What I'm overall asking, is there a way I can modify the ffmpeg command to prevent the audio desync issues, and what might be causing the problems I'm getting when attempting to find the length of the video with audio ?


import keyboard, signal
from os import remove
from os.path import isfile
from subprocess import Popen, getoutput
from datetime import datetime
import configparser

class Main:
 def __init__(self, save_location, framerate, duration):
 self.save_location = save_location
 self.framerate = int(framerate)
 self.duration = int(duration)
 self.working = self.save_location + '\\' + 'working.avi'
 self.start_recording()

 def start_recording(self):
 if isfile(self.working):
 remove(self.working)

 # start recording to working file at set framerate
 self.process = Popen(f'ffmpeg -thread_queue_size 578 -f gdigrab -video_size 1920x1080 -i desktop -f dshow -i audio="Stereo Mix (Realtek High Definition Audio)" -b:v 7M -minrate 4M -framerate {self.framerate} {self.working}')
 #self.process = Popen(f'ffmpeg -f gdigrab -framerate {self.framerate} -video_size 1920x1080 -i desktop -b:v 7M -minrate 2M {self.working}')

 def trim_video(self):
 # stop recording working file
 self.process.send_signal(signal.CTRL_C_EVENT)

 # call 'cause I have to
 getoutput(f"ffprobe -i {self.working}")

 # get length of working video
 length = getoutput(f'ffprobe -i {self.working} -show_entries format=duration -v quiet -of csv="p=0"')

 # get time before desired recording time
 start = float(length) - self.duration

 # get save location and title
 title = self.save_location+'\\'+self.get_time()+'.avi'

 # cut to last amount of desired time
 Popen(f"ffmpeg -ss {start} -i {self.working} -c copy -t {self.duration} {title}")
 getoutput(f"ffprobe -i {self.working}")

 self.start_recording()

 def get_time(self):
 now = datetime.now()
 return now.strftime("%Y_%m_%d#%H-%M-%S")


if __name__ == "__main__":
 config = configparser.ConfigParser()
 config.read("settings.ini")
 config = config["DEFAULT"]

 run = Main(config["savelocation"].replace("\\", "\\\\"), config["framerate"], config["recordlast"])
 keyboard.add_hotkey("ctrl+shift+alt+g", lambda:run.trim_video())

 while True:
 try:
 keyboard.wait()
 except KeyboardInterrupt:
 pass



The contents of the settings.ini file are listed below


[DEFAULT]
savelocation = C:\
framerate = 30
recordlast = 10



In the code block, the first line with
self.process = Popen
is the one that records audio and has the issues, the second line (the commented out one below) is the one that works fine.

-
avutil/channel_layout : add 22.2 layout
11 juin 2020, par Jan Ekströmavutil/channel_layout : add 22.2 layout
Requires some extraneous top side and bottom front channels to be
defined.According to STD-B59v2, the defined channel layout is :
FL
FR
FC
LFE1
BL
BR
FLc
FRc
BC
LFE2
SiL
SiR
TpFL
TpFR
TpFC
TpC
TpBL
TpBR
TpSiL
TpSiR
TpBC
BtFC
BtFL
BtFR