
Recherche avancée
Autres articles (50)
-
Mise à jour de la version 0.1 vers 0.2
24 juin 2013, parExplications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...) -
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)
Sur d’autres sites (4168)
-
lavfi/drawutils : overhaul to improve pixel format support
24 décembre 2021, par rcombslavfi/drawutils : overhaul to improve pixel format support
No longer mixes u8 and u16 component accesses (this was UB)
De-duplicated 8->16 conversion
De-duplicated component -> plane+offset conversion
De-duplicated planar + packed RGB
No longer calls ff_fill_rgba_map
Removed redundant comp_mask data member
RGB0 and related formats no longer write an alpha value to the 0 byte
Non-planar YA formats now work correctly
High-bit-depth semi-planar YUV now works correctly
-
ffmpeg - Build HLS stream with all tracks of the input source
25 juillet 2021, par Kaydee DunlopI would like to create HLS streams for videos. I'm working since more than 2 days now to find a solution that might work but no luck till now to get all tracks of the input inside my HLS output.


What I want in the end is a small script that can merge all tracks form a mp4 imput together and create a proper master.m3u8 playlist referencing all other m3u8 playlists of my m4s, webvtt and audio snippets. Currently I don't have adaptive streaming implemented. To save bandwidth I only want to have one video stream output at a max resolution of 1080p @ 3 Mbit/s.


This is my current state of work, please feel free to to use it :


#!/usr/bin/env bash
LC_NUMERIC="en_US.UTF-8"
START_TIME=$SECONDS
set -e

echo "-----START GENERATING HLS STREAM-----"
# Usage create-vod-hls.sh SOURCE_FILE [OUTPUT_NAME]
[[ ! "${1}" ]] && echo "Usage: create-vod-hls.sh SOURCE_FILE [OUTPUT_NAME]" && exit 1

# comment/add lines here to control which renditions will be created
renditions=(
# resolution bitrate audio-rate
 "1920x1080 3000k 128k"
)

segment_target_duration=20 # try to create a new segment every 10 seconds
max_bitrate_ratio=1.07 # maximum accepted bitrate fluctuations
rate_monitor_buffer_ratio=1.5 # maximum buffer size between bitrate conformance checks

#########################################################################

source="${1}"
target="${2}"
if [[ ! "${target}" ]]; then
 target="${source##*/}" # leave only last component of path
 target="${target%.*}" # strip extension
fi
mkdir -p ${target}

# ----CUSTOM----
sourceResolution="$(ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 ${source})"
# echo ${sourceResolution}
arrIN=(${sourceResolution//x/ })
sourceWidth="${arrIN[0]}"
sourceHeight="${arrIN[1]}"

echo ${sourceWidth}
echo ${sourceHeight}

sourceAudioBitRate="$(ffprobe -v error -select_streams a:0 -show_entries stream=bit_rate -of csv=s=x:p=0 ${source})"
sourceAudioBitRateFormatted=$((sourceAudioBitRate / 1000))
# ----END CUSTOM----

key_frames_interval="$(echo `ffprobe ${source} 2>&1 | grep -oE '[[:digit:]]+(.[[:digit:]]+)? fps' | grep -oE '[[:digit:]]+(.[[:digit:]]+)?'`*2 | bc || echo '')"
key_frames_interval=${key_frames_interval:-50}
key_frames_interval=$(echo `printf "%.1f\n" $(bc -l <<<"$key_frames_interval/10")`*10 | bc) # round
key_frames_interval=${key_frames_interval%.*} # truncate to integer

# static parameters that are similar for all renditions
static_params="-c:s webvtt -c:a aac -ar 48000 -c:v copy -sc_threshold 0"
static_params+=" -g ${key_frames_interval} -keyint_min ${key_frames_interval} -hls_time ${segment_target_duration}"
static_params+=" -hls_playlist_type vod -hls_segment_type fmp4"
static_params+=" -var_stream_map v:0,a:0,s:0"

# misc params
misc_params="-hide_banner -y"

master_playlist="#EXTM3U
#EXT-X-VERSION:3
"
cmd=""
resolutionValid=0
prevHeight=0
for rendition in "${renditions[@]}"; do
 # drop extraneous spaces
 rendition="${rendition/[[:space:]]+/ }"

 # rendition fields
 resolution="$(echo ${rendition} | cut -d ' ' -f 1)"
 bitrate="$(echo ${rendition} | cut -d ' ' -f 2)"
 audiorate="$(echo ${rendition} | cut -d ' ' -f 3)"

 audioBitRateFormatted=${audiorate%?} # remove "k" at the last index

 # take highest possible audio bit rate
 if [ $audioBitRateFormatted -gt $sourceAudioBitRateFormatted ]; then
 audiorate=${sourceAudioBitRateFormatted}k
 fi

 # calculated fields
 width="$(echo ${resolution} | grep -oE '^[[:digit:]]+')"
 height="$(echo ${resolution} | grep -oE '[[:digit:]]+$')"
 maxrate="$(echo "`echo ${bitrate} | grep -oE '[[:digit:]]+'`*${max_bitrate_ratio}" | bc)"
 bufsize="$(echo "`echo ${bitrate} | grep -oE '[[:digit:]]+'`*${rate_monitor_buffer_ratio}" | bc)"
 bandwidth="$(echo ${bitrate} | grep -oE '[[:digit:]]+')000"
 name="stream"
 
 widthParam=0
 heightParam=0

 if [ $(((width / sourceWidth) * sourceHeight)) -gt $height ]; then
 widthParam=-2
 heightParam=$height
 else
 widthParam=$width
 heightParam=-2
 fi
 
 #cmd+=" ${static_params} -vf scale=w=${widthParam}:h=${heightParam}"
 cmd+=" -b:v ${bitrate} -maxrate ${maxrate%.*}k -bufsize ${bufsize%.*}k -b:a ${audiorate}"
 cmd+=" -hls_segment_filename ${target}/${name}_%03d.m4s ${target}/${name}.m3u8"
 
 # add rendition entry in the master playlist
 master_playlist+="#EXT-X-STREAM-INF:BANDWIDTH=${bandwidth},RESOLUTION=${resolution}\n${name}.m3u8\n"

 resolutionValid=1
 prevHeight=${height}
done

if [ $resolutionValid -eq 1 ]; then
 # start conversion
 echo -e "Executing command:\nffmpeg ${misc_params} -i ${source} ${cmd}\n"
 ffmpeg ${misc_params} -i ${source} ${cmd}
 # create master playlist file
 echo -e "${master_playlist}" > ${target}/playlist.m3u8
 echo "Done - encoded HLS is at ${target}/"
else
 echo "Video source is too small"
 exit 1
fi

ELAPSED_TIME=$(($SECONDS - $START_TIME))

echo "Elapsed time: ${ELAPSED_TIME}"
echo "-----FINISH GENERATING HLS STREAM-----"



-
How to use ffmpeg to convert video into the audio format with nodejs and angular in web app
31 août 2021, par Amir ShahzadI want to convert the video into the audio format using ffmpeg in nodejs but I not know how I can implement it in the angular app with nodejs.


This is my nodejs code


const express = require('express');
 const ffmpeg = require('fluent-ffmpeg');
 const fileUpload = require('express-fileupload');
 const cors = require('cors')
 const app = express();

 app.use(fileUpload({
 useTempFiles: true,
 tempFileDir: 'temp/'
 }));
 app.use(express.json());
 app.use(express.urlencoded({ extended: true }));
 app.use(cors({ origin: 'http://localhost:4200' }));

 ffmpeg.setFfmpegPath('/usr/bin/ffmpeg');

 // Converting mp4 to audio
 app.post('/mp4tomp3', (req, res) => {
 res.contentType('video/avi');
 res.attachment('output.mp3');
 req.files.mp4.mv("temp/" + req.files.mp4.name , function(err) {
 if(err){
 res.sendStatus(500).send(err)
 }else{
 console.log("Fiel Uploaded Successfully.!");
 }
 });
 ffmpeg('temp/' + req.files.mp4.name)
 .toFormat('mp3')
 .on('end', function() {
 console.log('Done');
 })
 .on('error', function(err){
 console.log('An Error Occured' + err.message)
 })
 .pipe(res, {end: true})
 })

 app.listen(3000, () => {
 console.log('Server Start On Port 3000')
 })



This code is working good when I use index.html file in the nodejs app but its give an error while I remove index.html file and use angular app for frontend then it give error in nodejs mp4 not defined and name mv is not defined Please tell me how I can implement it using angular framework


This is my app.component.html file


<div class="container">
 <h1>Video Proccessing App</h1>
 <form>
 <input type="file" formcontrolname="mp4" />
 <input type="submit" value="Convert" />
 </form>
 </div>
 



This is my app.component.ts file


import { Component, OnInit } from '@angular/core';
 import { FormBuilder, FormGroup, Validators } from '@angular/forms';
 import { VideoConversionService } from 'src/services/video-conversion.service';

 @Component({
 selector: 'app-root',
 templateUrl: './app.component.html',
 styleUrls: ['./app.component.css']
 })
 export class AppComponent implements OnInit {

 submitted =false;
 form! : FormGroup
 data:any


 constructor(private formBuilder: FormBuilder,
 private videoService: VideoConversionService){}


 creatForm(){
 this.form = this.formBuilder.group({
 mp4: ['', Validators.required],
 });
 }
 ngOnInit(): void {
 this.creatForm();

 }


 convertVideo(){
 this.submitted = true
 this.videoService.conversion(this.form.value).subscribe(res => {
 this.data = res;
 // console.log(this.data)
 //console.log(this.form.value)
 })
 }

 }



This is my service file for handling the backend api in my angular app


import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Injectable({
 providedIn: 'root'
})
export class VideoConversionService {

constructor(private httpClient: HttpClient) { }

conversion(data: any){
 return this.httpClient.post('http://localhost:3000/mp4tomp3', data)
}
}



This is Screenshot of chrome error




This is the screenshot of the nodejs app error while I click on the convert button