Recherche avancée

Médias (0)

Mot : - Tags -/performance

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (74)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • Script d’installation automatique de MediaSPIP

    25 avril 2011, par

    Afin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
    Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
    La documentation de l’utilisation du script d’installation (...)

  • Automated installation script of MediaSPIP

    25 avril 2011, par

    To overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
    You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
    The documentation of the use of this installation script is available here.
    The code of this (...)

Sur d’autres sites (4144)

  • Gnuplot how to set a variable to standard-input if not passed

    27 août 2020, par DDS

    I have a gnuplot script (plot.script) that is invoked like

    


    C:> ffmpeg -i '.\my_awesome_audio_file.wav' -filter_complex aformat=channel_layouts=mono -acodec pcm_s16le -ar 4000 -f data - | gnuplot -e "fileout='plot';fileformat='png';wid=500;" .\plot.script        


    


    Now I'd want to default filein variable to stdin if it is not passed as argument. This because I want to be able to call this script as a 1-liner command with ffmpeg data generation and also as step-by-step procedure

    


    My idea was to use

    


    if(!exists('filein')){
filein = '-';
}


    


    but this throws warning: Skipping data file with no valid points

    


    if i print the variable datafile I got - (I expected something like stdin).

    


    this is the plot.script script :

    


    
if(!exists('filein')){
    filein = '-';
    }

if (!exists("hei")){
    hei = 4444;
    }
if (!exists("wid")){
    wid = 5555;
    }
if(!exists("fileformat")){
     fileformat = 'png';
     }
if(!exists("fileout")){
     fileout = 'risultato';
   }
   
fileout = fileout . '.' . fileformat;
   
if(!exists("dataformat")){
    dataformat = '%int16';
    }
if(fileformat eq 'png'){
  set terminal png transparent size larghezza,altezza;
  
  }else{
  set terminal fileformat size wid,hei;
  }
  set output fileout;
  unset key;
  unset tics;
  unset border;
  set lmargin 0;
  set rmargin 0;
  set tmargin 0;
  set bmargin 0;


print filein;
plot filein binary filetype=bin format=dataformat endian=little array=1:0 with lines linecolor "0x009900";


    


    But I also want to call this command-by-command :
generate the data-file :

    


    c:> ffmpeg -i '.\my_awesome_audio_file.wav' -filter_complex aformat=channel_layouts=mono -acodec pcm_s16le -ar 4000 -f data audio.dat


    


    plot the data :

    


    c:> gnuplot -e "filein='audio.dat';fileout='plot';fileformat='png';wid=500;" .\plot.script


    


  • libav sws_scale() fails colorspace conversion on real device, works on emulator

    26 août 2020, par chugadie

    I'm making a movie player with libav. I have decoding video packets working, I have play in reverse working, I have seeking working. All this works no an x86 android emulator, but fails to work on a real android phone (arm64-v8a)

    


    The failure is in sws_scale() - it returns 0. The video frames continue to be decoded properly with no errors.

    


    There are no errors, warnings, alerts from libav. I have connected an avlog_callback

    


    void log_callback(void *ptr, int level, const char *fmt, va_list vargs) {
    if (level<= AV_LOG_WARNING)
        __android_log_print( level, LOG_TAG, fmt, vargs);
}
uint64_t openMovie( char* path, int rotate, float javaDuration )
{
    av_log_set_level(AV_LOG_WARNING);
    av_log_set_callback(log_callback);


    


    The code to do the sws_scale() is :

    


    int JVM_getBitmapBuffer( JNIEnv* env, jobject thiz, jlong av, jobject bufferAsInt, jbyte transparent ) { 
    avblock *block = (avblock *) av;
    if (!block) {
        __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "  avblock is null");
        return AVERROR(EINVAL);
    }
    if (!block->pCodecCtx) {
        __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "  codecctx is null");
        return AVERROR(EINVAL);
    }

    int width = block->pCodecCtx->width;
    int height = block->pCodecCtx->height;

    if (NULL == block->sws) {
        __android_log_print( ANDROID_LOG_ERROR, LOG_TAG, "getBitmapBuffer:\n  *** invalid sws context ***" );
    }

    int scaleRet = sws_scale( block->sws,
            block->pFrame->data,
            block->pFrame->linesize,
            0,
            height,
            block->pFrameRGB->data,
            block->pFrameRGB->linesize
    );
    if (scaleRet == 0 ) {
        __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "  scale failed");
        __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "  pframe linesize    %d", block->pFrame->linesize[0]); 
        __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "  pframergb linesize %d", block->pFrameRGB->linesize[0]); 
        __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "  height  %d",
        height);
        return AVERROR(EINVAL);
    }


    


    Setting up the codex and avframes :

    


    //i have tried every combination of 1, 8, 16, and 32 for these values
int alignRGB = 32;
int align    = 16; 
int width    = block->pCodecCtx->width;
int height   = block->pCodecCtx->height;
block->pFrame    = av_frame_alloc();
block->pFrameRGB = av_frame_alloc();

block->pFrameRGBBuffer = av_malloc(
    (size_t)av_image_get_buffer_size(AV_PIX_FMT_RGB32, width, height, alignRGB) 
);

av_image_fill_arrays(
    block->pFrameRGB->data,
    block->pFrameRGB->linesize,
    block->pFrameRGBBuffer,
    AV_PIX_FMT_RGB32,
    width,
    height,
    alignRGB
);

block->pFrameBuffer = av_malloc(
        (size_t) av_image_get_buffer_size(block->pCodecCtx->pix_fmt,
                                          width, height, align
        )
);
av_image_fill_arrays(
    block->pFrame->data,
    block->pFrame->linesize,
    block->pFrameBuffer,
    block->pCodecCtx->pix_fmt,
    width, height,
    align
);
block->sws = sws_getContext(
    width, height,
    AV_PIX_FMT_YUV420P,
    width, height,
    AV_PIX_FMT_RGB32,
    SWS_BILINEAR, NULL, NULL, 0
);


    


    Wildcards are that :

    


      

    • I'm using React-Native
    • 


    • My emulator is x86 android api 28
    • 


    • My real-device is arm64-v8a AOSP (around api 28, don't remember exactly(
    • 


    


    Other notes :

    


      

    • libav .so files are compiled from mobile-ffmpeg project.
    • 


    • I can also sws_scale also works on x86_64 linux using SDL to project YV12
    • 


    • Test video is here : https://github.com/markkimsal/video-thumbnailer/tree/master/fixtures
    • 


    • block is a simple C struct with pointers to relevant AV memory structures.
    • 


    • Using FFMPEG 4.3.2
    • 


    


    I'm pretty certain it has something to do with the pixel alignment. But documentation is practically non-existent on this topic. It could also be the difference between pixel formats RGBA and RGB32, or possibly little-endian vs big-endian.

    


  • ffmpeg audio and video gradually go out of sync when recorded with shell script and make

    6 août 2020, par cgmil

    I wrote the following shell script for making streamcasts for recording streams using ffmpeg :

    


    [ -z $1 ] && { echo "No recording device selected!" 2>&1 && exit ; } || DEV=$1
VIDFILE=video/bvid.mkv
AUDFILE=audio/baud.wav
DIM=$(xdpyinfo | grep dimensions: | awk '{print $2;}')
(sleep 10 && echo "Streaming...") &
ffmpeg -nostdin -loglevel panic -f x11grab -s $DIM -i $DISPLAY.0 -c:v libx264 "$VIDFILE" &
ffmpeg -nostdin -loglevel panic -f alsa -i hw:$DEV -c:a libmp3lame  "$AUDFILE" &
sleep 1
[ -f $VIDFILE ] && (echo "Created video" 1>&2) || (echo "No video!" 1>&2)
sleep 1
[ -f $AUDFILE ] && (echo "Created audio" 1>&2) || (echo "No audio!" 1>&2)

wait
trap "killall background -s 2" SIGINT


    


    This produces a video and audio file that can then be used to make a stream via make using the command make stream. Here is the Makefile (note that there is a 3-minute long audio file and a file with images that is used to make an opening splash screen) :

    


    FULLAUDIO=audio/full.wav
AUDSTART=84
TITLE="Stats Aside:\\nInterpreting\\nProbability"
SIZEW=1920
SIZEH=1080

audio/clip.wav : $(FULLAUDIO)
        ffmpeg -ss $(AUDSTART) -i $< -t 6 -af "afade=t=in:st=0:d=3:curve=qsin,afade=t=out:st=3:d=3:curve=qsin" -c:a libmp3lame $@

img/thumb.png : img/bg.png img/ico.png
        convert -stroke white -fill white -background black -transparent "#000000" \
                 -font "URWBookman-Light" -gravity Center -size 928x1080 \
                label:$(TITLE) png:- | composite -gravity west -geometry +64+0 - \
                img/bg.png $@
        convert img/ico.png -transparent "#ffffff" png:- | composite \
                 -gravity southeast -geometry +32+32 - $@ $@
        convert $@ -resize $(SIZEW)x$(SIZEH) $@

video/intro.mp4 : img/thumb.png audio/clip.wav
        ffmpeg -i audio/clip.wav -loop 1 -t 6 -i img/thumb.png -vf "fade=t=in:st=0:d=1,fade=t=out:st=5:d=1:c=white,scale=$(SIZEW):$(SIZEH)" -c:v libx264 -c:a libmp3lame $@

ProbabilityInterpretation.mp4 : video/bvid.mkv video/intro.mp4 audio/baud.wav
        ffmpeg -i video/intro.mp4 -ss 11 -i video/bvid.mkv \
                 -ss 10 -i audio/baud.wav \
                 -filter_complex \
                "[1]fade=t=in:st=0:d=1:c=white,scale=$(SIZEW):$(SIZEH)[bvid];\
                 [2]afftdn=nr=20[baud];\
                 [0:v][0:a][bvid][baud]concat=n=2:v=1:a=1[v][a]" -map "[v]" -map "[a]" \
                 -c:v libx264 -c:a libmp3lame $@

stream : ProbabilityInterpretation.mp4

clean:
        -rm ProbabilityInterpretation.mp4
        -rm video/intro.mp4
        -rm audio/clip.wav
        -rm img/thumb.png

veryclean:
        make clean
        -rm video/bvid.mkv
        -rm audio/baud.wav



    


    Because of lag between my webcam and what appears on screen, I do intentionally start the video and audio at different times so that they can eventually become in sync. However, the end result is a video that starts with the video and audio synced together, but eventually become out of sync, with the video lagging well behind the audio. Here is a link to the video with the end result ; it's long, but notice that the video starts in sync and ends out-of-sync. I should probably also note that the operating system is living in a virtual machine (VirtualBox).

    


    Why is this happening and what can I do to prevent or correct ?