Recherche avancée

Médias (91)

Autres articles (105)

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

  • Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs

    12 avril 2011, par

    La manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
    Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras.

  • Gestion de la ferme

    2 mars 2010, par

    La ferme est gérée dans son ensemble par des "super admins".
    Certains réglages peuvent être fais afin de réguler les besoins des différents canaux.
    Dans un premier temps il utilise le plugin "Gestion de mutualisation"

Sur d’autres sites (13127)

  • I use php-ffmpeg to add watermark to my video and the result throws an error Encoding failed

    13 juin 2023, par yu song

    I use php-ffmpeg to add watermark to my video and the result throws an error Encoding failed

    


    public function video_watermark()


    


    $video_url = $this->request->post("video_url",'\uploads\20230609\57a5e95d87e9802dc32012285ee77a4b.mp4');
$watermark_path = $this->request->post("watermark_path",'\uploads\20230613\398d67af5355a56b0820f900379420fb.png');

$rand_str32 = Random::alnum(32);
$base_dir_path = '/tmp/video_watermark/';
$dir_path = PUBLIC_PATH . $base_dir_path;
if (!is_dir($dir_path)) {
    mkdir(iconv("UTF-8", "GBK", $dir_path),0777,true);
}

$ffmpeg = FFMpeg::create();
$video = $ffmpeg->open($video_url);
// watermark
$video
    ->filters()
    ->watermark($watermark_path, array(
        'position' => 'relative',
        'bottom' => 50,
        'right' => 50,
    ));
$format = new X264();
$video->save($format, $dir_path . '/' . $rand_str32 . '.mp4');
// return
$this->success('success', [
    'video_url' => $dir_path . '/' . $rand_str32 . '.mp4'
], 200);


    


    


    When I print the command

    


    $command = $video->getFinalCommand($format, $dir_path . '/' . $rand_str32 . '.mp4') ;

    


    var_dump($command) ;die ;

    


    array(2) 
[0]=>
string(653) "-y -i D :\WWW\fastadmin\public\uploads\20230609\57a5e95d87e9802dc32012285ee77a4b.mp4 -vcodec libx264 -acodec aac -b:v 1000k -refs 6 -coder 1 -sc_threshold 40 -flags +loop -me_range 16 -subq 7 -i_qfactor 0.71 -qcomp 0.6 -qdiff 4 -trellis 1 -b:a 128k -vf movie=D :\WWW\fastadmin\public\uploads\20230613\398d67af5355a56b0820f900379420fb.png [watermark] ;[in][watermark] overlay=main_w - 50 - overlay_w:main_h - 50 - overlay_h [out] -pass 1 -passlogfile C :\Users\qq\AppData\Local\Temp\ffmpeg-passes6488893fb88c27rufi/pass-6488893fb8b6a D :\WWW\fastadmin\public/tmp/video_watermark//6lutEFvBLNSTP2Rfs7nW8xGAUMprz1ZD.mp4"
[1]=>
string(653) "-y -i D :\WWW\fastadmin\public\uploads\20230609\57a5e95d87e9802dc32012285ee77a4b.mp4 -vcodec libx264 -acodec aac -b:v 1000k -refs 6 -coder 1 -sc_threshold 40 -flags +loop -me_range 16 -subq 7 -i_qfactor 0.71 -qcomp 0.6 -qdiff 4 -trellis 1 -b:a 128k -vf movie=D :\WWW\fastadmin\public\uploads\20230613\398d67af5355a56b0820f900379420fb.png [watermark] ;[in][watermark] overlay=main_w - 50 - overlay_w:main_h - 50 - overlay_h [out] -pass 2 -passlogfile C :\Users\qq\AppData\Local\Temp\ffmpeg-passes6488893fb88c27rufi/pass-6488893fb8b6a D :\WWW\fastadmin\public/tmp/video_watermark//6lutEFvBLNSTP2Rfs7nW8xGAUMprz1ZD.mp4"


    


    go execute

    


    ffmpeg -y -i D :\WWW\fastadmin\public\uploads\20230609\57a5e95d87e9802dc32012285ee77a4b.mp4 -vcodec libx264 -acodec aac -b:v 1000k -refs 6 -coder 1 -sc_threshold 40 -flags +loop -me_range 16 -subq 7 -i_qfactor 0.71 -qcomp 0.6 -qdiff 4 -trellis 1 -b:a 128k -vf movie=D :\WWW\fastadmin\public\uploads\20230613\398d67af5355a56b0820f900379420fb.png [watermark] ;[in][watermark] overlay=main_w - 50 - overlay_w:main_h - 50 - overlay_h [out] -pass 2 -passlogfile C :\Users\qq\AppData\Local\Temp\ffmpeg-passes6488893fb88c27rufi/pass-6488893fb8b6a D :\WWW\fastadmin\public/tmp/video_watermark//6lutEFvBLNSTP2Rfs7nW8xGAUMprz1ZD.mp4

    


    Error

    


    [AVFormatContext @ 0000022ffb728f40] Unable to choose an output format for '[watermark] ;[in][watermark]' ; use a standard extension for the filename or specify the format manually.
[out#0 @ 0000022ffb728e40] Error initializing the muxer for [watermark] ;[in][watermark] : Invalid argument

    


    my php version 7.4 , php-ffmpeg v0.19.0 , ffmpeg version 5.1.2

    


    $format = new X264('libmp3lame', 'libx264') ;

    


    $format->setKiloBitrate(1000)->setAudioChannels(2)-> setAudioKiloBitrate(256) ;

    


    Still reporting an error, Encoding failed.

    


  • FFmpeg synthesizes multiple videos, the final result is only sound, no picture display

    6 juillet 2023, par Halifax

    1、I first converted mp4 to ts:

    


    -i MyVideo.mp4 -vcodec copy -acodec aac -b:v 10000k MyVideo.ts


    


    2、Then scale the ts and fill the empty space:

    


    -i MyVideo.ts -vf pad=width=iw:height=ih:x=-1:y=0:color='White' -b:v 10000k MyVideo_transform.ts


    


    3、Finally use concat to merge into mp4 files:

    


    -i "concat:MyVideo_transform1.ts|MyVideo_transform2.ts" -acodec copy -vcodec copy -absf aac_adtstoasc -b:v 10000k $outputFilePath"


    


    Finally use concat to merge into mp4 files。

    


    I hope that the final merged result can see the video picture。

    


  • Different ffmpeg result after saving to png

    28 juillet 2023, par Kalev Maricq

    Saving images to PNG first seems to produce different ffmpeg encodes. Running this test code

    


    from PIL import Image
import cv2
import ffmpeg
import hashlib

ffmpeg.input('test.jpg').output('testff.png').run()
cv2.imwrite('testcv.png',cv2.imread('test.jpg'))
Image.open('test.jpg').save('testpil.png')

hashes=[]
for suf in ['.jpg','ff.png','cv.png','pil.png']:
    dest='test'+suf.replace('.','')+'.mp4'
    ffmpeg.input('test'+suf).output(dest).run()
    hashes.append(hashlib.file_digest(open(dest,'rb'),'md5').hexdigest())
    
print(hashes)


    


    I get
    
['a5b744a8ac0f6de9ec4de43ff737c46e'
    
,'ab62474f2160899e064ba24890047372'
    
,'baa788d5e4ef212ab610b8b5cf7772cb'
    
,'baa788d5e4ef212ab610b8b5cf7772cb']

    


    As you can see, the only two that match are the cv2 and pillow conversions, and none of them match the original. In terms of file size, the results that passed to png first seem to be about 10% smaller than the direct-from-jpg result.

    


    Why is this happening and how can I avoid changing image data until I'm ready to encode ?