
Recherche avancée
Médias (1)
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (36)
-
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page. -
List of compatible distributions
26 avril 2011, parThe table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...) -
Les formats acceptés
28 janvier 2010, parLes commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
ffmpeg -codecs ffmpeg -formats
Les format videos acceptés en entrée
Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
Les formats vidéos de sortie possibles
Dans un premier temps on (...)
Sur d’autres sites (5864)
-
FFMPEG - how to transcode input stream while cutting off first few seconds of video and audio
25 septembre 2020, par purplepear24I am using ffmpeg to transcode a screen-record (x11) input stream to MP4. I would like to cut off the first 10 seconds of the stream, which is just a blank screen (this is intentional).


I understand how to trim video with ffmpeg when converting from mp4 to another mp4, but i can't find any working solution for processing an input stream while accounting for delay and audio/video syncing.


Here is my current code :


const { spawn } = require('child_process');
const { S3Uploader } = require('./utils/upload');

const MEETING_URL = process.env.MEETING_URL || 'Not present in environment';
console.log(`[recording process] MEETING_URL: ${MEETING_URL}`);

const args = process.argv.slice(2);
const BUCKET_NAME = args[0];
console.log(`[recording process] BUCKET_NAME: ${BUCKET_NAME}`);
const BROWSER_SCREEN_WIDTH = args[1];
const BROWSER_SCREEN_HEIGHT = args[2];
const MEETING_ID = args[3];
console.log(`[recording process] BROWSER_SCREEN_WIDTH: ${BROWSER_SCREEN_WIDTH}, BROWSER_SCREEN_HEIGHT: ${BROWSER_SCREEN_HEIGHT}, TASK_NUMBER: 43`);

const VIDEO_BITRATE = 3000;
const VIDEO_FRAMERATE = 30;
const VIDEO_GOP = VIDEO_FRAMERATE * 2;
const AUDIO_BITRATE = '160k';
const AUDIO_SAMPLERATE = 44100;
const AUDIO_CHANNELS = 2
const DISPLAY = process.env.DISPLAY;

const transcodeStreamToOutput = spawn('ffmpeg',[
 '-hide_banner',
 '-loglevel', 'error',
 // disable interaction via stdin
 '-nostdin',
 // screen image size
 // '-s', `${BROWSER_SCREEN_WIDTH}x${BROWSER_SCREEN_HEIGHT}`,
 '-s', '1140x720',
 // video frame rate
 '-r', `${VIDEO_FRAMERATE}`,
 // hides the mouse cursor from the resulting video
 '-draw_mouse', '0',
 // grab the x11 display as video input
 '-f', 'x11grab',
 '-i', ':1.0+372,8',
 // '-i', `${DISPLAY}`,
 // grab pulse as audio input
 '-f', 'pulse', 
 '-ac', '2',
 '-i', 'default',
 // codec video with libx264
 '-c:v', 'libx264',
 '-pix_fmt', 'yuv420p',
 '-profile:v', 'main',
 '-preset', 'veryfast',
 '-x264opts', 'nal-hrd=cbr:no-scenecut',
 '-minrate', `${VIDEO_BITRATE}`,
 '-maxrate', `${VIDEO_BITRATE}`,
 '-g', `${VIDEO_GOP}`,
 // apply a fixed delay to the audio stream in order to synchronize it with the video stream
 '-filter_complex', 'adelay=delays=1000|1000',
 // codec audio with aac
 '-c:a', 'aac',
 '-b:a', `${AUDIO_BITRATE}`,
 '-ac', `${AUDIO_CHANNELS}`,
 '-ar', `${AUDIO_SAMPLERATE}`,
 // adjust fragmentation to prevent seeking(resolve issue: muxer does not support non seekable output)
 '-movflags', 'frag_keyframe+empty_moov+faststart',
 // set output format to mp4 and output file to stdout
 '-f', 'mp4', '-'
 ]
);

transcodeStreamToOutput.stderr.on('data', data => {
 console.log(`[transcodeStreamToOutput process] stderr: ${(new Date()).toISOString()} ffmpeg: ${data}`);
});

const timestamp = new Date();
const year = timestamp.getFullYear();
const month = timestamp.getMonth() + 1;
const day = timestamp.getDate();
const hour = timestamp.getUTCHours();
console.log(MEETING_ID);
const fileName = `${year}/${month}/${day}/${hour}/${MEETING_ID}.mp4`;
new S3Uploader(BUCKET_NAME, fileName).uploadStream(transcodeStreamToOutput.stdout);

// event handler for docker stop, not exit until upload completes
process.on('SIGTERM', (code, signal) => {
 console.log(`[recording process] exited with code ${code} and signal ${signal}(SIGTERM)`);
 process.kill(transcodeStreamToOutput.pid, 'SIGTERM');
});

// debug use - event handler for ctrl + c
process.on('SIGINT', (code, signal) => {
 console.log(`[recording process] exited with code ${code} and signal ${signal}(SIGINT)`)
 process.kill('SIGTERM');
});

process.on('exit', function(code) {
 console.log('[recording process] exit code', code);
});



Any help would be greatly appreciated !


-
ffmpeg x11grab Fedora 22 cannot open display [on hold]
4 août 2015, par voorRunning a fairly recent version of Fedora 22 :
Linux localhost 4.1.3-200.fc22.x86_64 #1 SMP Wed Jul 22 19:51:58 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Dual screen Acer XB270HU and AOC 2369. Also uses NVIDIA Drivers :
➜ ~ rpm -qa | grep nvidia
nvidia-driver-libs-352.30-1.fc22.x86_64
nvidia-driver-352.30-1.fc22.x86_64
nvidia-settings-352.30-1.fc22.x86_64
nvidia-libXNVCtrl-352.30-1.fc22.x86_64
dkms-nvidia-352.30-1.fc22.x86_64
nvidia-driver-libs-352.30-1.fc22.i686Whenever I attempt to do a x11grab in ffmpeg I get an error :
➜ ~ ffmpeg -f x11grab -r 15 -s 1920x1080 -i :0 -vcodec h264 -crf 30 -y output.mp4
ffmpeg version 2.6.3 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 5.1.1 (GCC) 20150422 (Red Hat 5.1.1-1)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-frei0r --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
libavutil 54. 20.100 / 54. 20.100
libavcodec 56. 26.100 / 56. 26.100
libavformat 56. 25.101 / 56. 25.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 11.102 / 5. 11.102
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Invalid MIT-MAGIC-COOKIE-1 key[x11grab @ 0x1fe1d40] Cannot open display :0, error 1.
:0: Input/output errorI’ve tried a few different commands basically copy/pasta from the web on how to do screengrabs. I don’t need audio, just video, and all of them result in the same error.
I am able to do
xwininfo
without any problems :➜ ~ xwininfo
xwininfo: Please select the window about which you
would like information by clicking the
mouse in that window.
xwininfo: Window id: 0x1e0006c "linux - ffmpeg x11grab Fedora 22 cannot open display - Stack Overflow - Google Chrome"
Absolute upper-left X: 0
Absolute upper-left Y: 27
Relative upper-left X: 0
Relative upper-left Y: 27
Width: 2560
Height: 1413
Depth: 24
Visual: 0x21
Visual Class: TrueColor
Border width: 0
Class: InputOutput
Colormap: 0x20 (installed)
Bit Gravity State: ForgetGravity
Window Gravity State: NorthWestGravity
Backing Store State: NotUseful
Save Under State: no
Map State: IsViewable
Override Redirect State: no
Corners: +0+27 -1920+27 -1920-0 0
-geometry 2560x14130 -
OpenCv is giving error to play the downloaded video
17 août 2015, par Prat_yowProgram a code for a tiny system, which should run on Linux :
A routine (P) accepts strings from an unknown remote Internet source,
which contain just an URL and a file name.The URL and the file name point to a multimedia file, in our case a video
(P) separates the file name from the string
(P) checks if the file already exists on the system’s internal memory card, as
(P) is running on a tiny Linux machine connected to a screenIf it does not exist, (P) downloads the video file from the given URL and
stores it in the memory cardFinally, (P) opens the file and plays it as a full screen video (no external video
player allowed !)After this (P) starts from the beginning
There is no user action involved and nobody enters data by hand or mouse
clicksI have written code in python. But when I run it it just not load the cv module. Can someone suggest if my approach is correct.? Will doing in java or other compiled language will be easy.?
My code is :
import os
import urllib
import cv
import sys
"""
The following program will take the url as input. Separate the file name of the video from the url
and check if the file is present in the current memory location or not. If the same file is present
it will indicate its presence. If the file is not present it will download the file and play it.
urrlib: to download the video file.
cv: For playing the video.
"""
#NOTE Configuration of FFMPEG and OpenCV is required.
#NOTE Assuming that the given code is execute from the internal memory location.
#NOTE Assuming the URL is of the form <initial part="part" of="of" the="the" url="url"></initial><filename>.<format>
sys.path.append('/opt/ros/hydro/lib/python2.7/dist-packages')
def myVideo(url):
search_folder = "."
videoFile = url.split('/')[-1].split('#')[0].split('?')[0] #stripping the name of the file.
for root, dirs, files in os.walk(search_folder): # using the os.walk module to find the files.
for name in files:
#print os.path.join(name)
"""Checking the videofile in the current directory and the sub-directories"""
if videoFile == os.path.join(name): #checking if the file is already present in the internal memory.
print "The file is already present in the internal memory"
return -1 # Returning the confirmation that the file is present.
else:
print "Downloading the file"
video = urllib.FancyURLopener() #downloading the file using urllib.
video.retrieve(url,videoFile)
curDir = os.getcwd() # getting the current working directory.
fullVideoPath = os.path.join(curDir,videoFile) # Making the full path of the video file.
"""For playing the file using openCV first read the file.
Find the number of frames and the frame rate.
Finally use these parameters to display each extracted frame on the screen"""
vFile = cv.CaptureFromFile(fullVideoPath)
nFrames = int( cv.GetCaptureProperty( vidFile, cv.CV_CAP_PROP_FRAME_COUNT ) ) #Number of frames in the video.
fps = cv.GetCaptureProperty( vidFile, cv.CV_CAP_PROP_FPS ) # Frame rate
waitPerFrameInMillisec = int( 1/fps * 1000/1 ) # Wait time between frames.
for f in xrange( nFrames ):
frameImg = cv.QueryFrame( vidFile )
cv.ShowImage( "My Show", frameImg )
cv.WaitKey( waitPerFrameInMillisec )
cv.DestroyWindow( "My Show" ) # Deleting the window once the playing is done.
return 1 # returning the confimation that the file was played successfully.
if __name__ == "__main__":
url = "http://techslides.com/demos/sample-videos/small.mp4"
myVideo(url)
</format></filename>