Recherche avancée

Médias (91)

Autres articles (67)

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

Sur d’autres sites (10221)

  • convert MOV to mp4 using transcode

    3 janvier 2017, par koem

    I want to convert a MOV from my Casio cam to mp4 using transcode. Why transcode ? Because I also want to deshake the video in the same step.

    When I use

    ffmpeg -i in.MOV out.mp4

    it works. When using

    transcode -J stabilize -i in.MOV

    or

    transcode -J transform -i in.MOV -y ffmpeg -F mpeg4 -o out.mp4

    I get hundreds of these errors :

    [ffmpeg_audio] Error: avcodec_open2 failed
    [adpcm_ima_wav @ 0x1f7f180] Only 4-bit ADPCM IMA WAV files are supported

    This looks to me as if transcode uses ffmpeg internally.

    I could use ffmpeg to make it mp4 first and then use transcode to stabilize the video, but then it would be re-encoded twice which I would like to avoid.

    This is what mplayer says about my MOV file :

    MPlayer2 2.0-701-gd4c5b7f-2ubuntu2 (C) 2000-2012 MPlayer Team
    Cannot open file '/home/koem/.mplayer/input.conf': No such file or directory
    Failed to open /home/koem/.mplayer/input.conf.
    Cannot open file '/etc/mplayer/input.conf': No such file or directory
    Failed to open /etc/mplayer/input.conf.

    Playing 1-original.MOV.
    Detected file format: QuickTime / MOV (libavformat)
    [lavf] stream 0: video (h264), -vid 0
    [lavf] stream 1: audio (adpcm_ima_wav), -aid 0, -alang eng
    Clip info:
    major_brand: qt  
    minor_version: 537921536
    compatible_brands: qt  caqv
    creation_time: 2017-01-02 23:31:38
    Load subtitles in .
    Failed to open VDPAU backend libvdpau_i965.so: cannot open shared object file: No such file or directory
    [vdpau] Error when calling vdp_device_create_x11: 1
    [ass] auto-open
    Selected video codec: H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 [libavcodec]
    Selected audio codec: ADPCM IMA WAV [libavcodec]
    AUDIO: 44100 Hz, 2 ch, s16le, 352.8 kbit/25.00% (ratio: 44100->176400)
    AO: [pulse] 44100Hz 2ch s16le (2 bytes per sample)
    Starting playback...
    VIDEO:  1920x1080  29.970 fps  15940.0 kbps (1992.5 kB/s)
    VO: [xv] 1920x1080 => 1920x1080 Planar YV12
    Colorspace details not fully supported by selected vo.
    A:   1.1 V:   1.1 A-V: -0.000 ct:  0.000   0/  0 16%  8%  1.6% 0 0

    Exiting... (Quit)

    How can I make it work with transcode without using ffmpeg first ?

  • FFmpeg API - transcoding and sending pulseaudio input (rtsp)

    16 octobre 2020, par user3469024

    My goal is to read pulseaudio microphone audio input and send it via rtsp encoded as opus. To play stream I am using ffplay.

    


    What step am I missing ? Currently I am hearing only noise when receiving stream. What is interesting, av_dump_format shows correct output :

    


    Input #0, pulse, from 'default':
  Duration: N/A, start: 1602879120.276839, bitrate: 1536 kb/s
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
Output #0, rtsp, to 'rtsp://localhost:8191/call':
    Stream #0:0: Audio: opus, 8000 Hz, mono, s16, 16 kb/s



    


    but ffplay shows different stream parameters :

    


    Input #0, rtsp, from 'rtsp://localhost:8191/call':sq=    0B f=0/0   
  Metadata:
    title           : No Name
  Duration: N/A, start: 51444.871521, bitrate: N/A
    Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp



    


    #include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libswscale></libswscale>swscale.h>&#xA;#include &#xA;&#xA;int main(int argc, char *argv[])&#xA;{&#xA;  int ret,got_frame,got_packet;&#xA;  const char *audio_input;&#xA;  const char *output;&#xA;  AVOutputFormat *out_format = NULL;&#xA;  AVInputFormat *in_format = NULL;&#xA;  AVFormatContext *in_format_ctx = NULL;&#xA;  AVFormatContext *out_format_ctx = NULL;&#xA;  AVCodec *in_codec = NULL;&#xA;  AVCodecContext *in_codec_ctx = NULL;&#xA;  AVCodec *out_codec = NULL;&#xA;  AVCodecContext *out_codec_ctx = NULL;&#xA;  AVPacket packet = { .data = NULL, .size = 0 };&#xA;  AVFrame *frame = NULL;&#xA;  AVDictionary *opt = NULL;&#xA;  AVStream *ost;&#xA;&#xA;  av_register_all();&#xA;  avdevice_register_all();&#xA;&#xA;  audio_input = argv[1];&#xA;  output = argv[2];&#xA;&#xA;  //INPUT&#xA;  //Open input in selected format&#xA;  in_format = av_find_input_format("pulse");&#xA;  if((ret = avformat_open_input(&amp;in_format_ctx, audio_input, in_format, NULL))!=0)&#xA;  {&#xA;    fprintf(stderr,"Could not open audio input: %s. %s\n",audio_input,av_err2str(ret));&#xA;    exit(1);&#xA;  }&#xA;&#xA;  //Find stream info in header and display&#xA;  if((ret = avformat_find_stream_info(in_format_ctx, NULL))&lt;0)&#xA;  {&#xA;    fprintf(stderr,"Could not find stream information. %s\n",av_err2str(ret));&#xA;    exit(1);&#xA;  }&#xA;&#xA;  av_dump_format(in_format_ctx, 0, audio_input, 0);&#xA;&#xA;  in_codec = avcodec_find_decoder(in_format_ctx->streams[0]->codec->codec_id);&#xA;  if(in_codec==NULL) {&#xA;    fprintf(stderr, "Unsupported decoder.\n");&#xA;    exit(1);&#xA;  }&#xA;&#xA;  //Allocate memory for microphone input codec context (all information)&#xA;  in_codec_ctx = avcodec_alloc_context3(in_codec);&#xA;  if((ret = avcodec_copy_context(in_codec_ctx, in_format_ctx->streams[0]->codec)) != 0) {&#xA;    fprintf(stderr, "Couldn&#x27;t copy codec context. %s\n",av_err2str(ret));&#xA;    exit(1);&#xA;  }&#xA;&#xA;  //Use selected codec and codec context&#xA;  if((ret = avcodec_open2(in_codec_ctx, in_codec, NULL))&lt;0)&#xA;  {&#xA;    fprintf(stderr, "Could not open audio codec. %s\n",av_err2str(ret));&#xA;    exit(1);&#xA;  }&#xA;&#xA;&#xA;  //OUTPUT&#xA;  ret = avformat_alloc_output_context2(&amp;out_format_ctx, NULL, "rtsp", output);&#xA;  if (!out_format_ctx) {&#xA;    fprintf(stderr, "Output format ptoblem. %s\n",av_err2str(ret));&#xA;    exit(1);&#xA;  }&#xA;&#xA;  out_format = out_format_ctx->oformat;&#xA;  /* open the output file, if needed */&#xA;&#xA;  out_codec = avcodec_find_encoder(AV_CODEC_ID_OPUS);&#xA;  if(out_codec==NULL) {&#xA;    fprintf(stderr, "Unsupported encoder.\n");&#xA;    exit(1);&#xA;  }&#xA;&#xA;  out_codec_ctx = avcodec_alloc_context3(out_codec);&#xA;  if (!out_codec_ctx) {&#xA;    fprintf(stderr, "Could not alloc an encoding context\n");&#xA;    exit(1);&#xA;  }&#xA;&#xA;  /* check that the encoder supports s16 pcm input */&#xA;  out_codec_ctx->sample_fmt = AV_SAMPLE_FMT_S16;&#xA;  out_codec_ctx->bit_rate    = 16000;&#xA;  out_codec_ctx->sample_rate = 8000;&#xA;  out_codec_ctx->channels    = 1;&#xA;  out_codec_ctx->channel_layout = AV_CH_LAYOUT_MONO;&#xA;  out_codec_ctx->channels        = av_get_channel_layout_nb_channels(out_codec_ctx->channel_layout);&#xA;&#xA;  if (out_format_ctx->oformat->flags &amp; AVFMT_GLOBALHEADER)&#xA;      out_codec_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;&#xA;&#xA;  ret = avcodec_open2(out_codec_ctx, out_codec, NULL);&#xA;  if (ret &lt; 0) {&#xA;    fprintf(stderr, "Could not open audio codec: %s\n", av_err2str(ret));&#xA;    exit(1);&#xA;  }&#xA;&#xA;  ost = avformat_new_stream(out_format_ctx, NULL);&#xA;  if (!ost) {&#xA;    fprintf(stderr, "Could not allocate stream\n");&#xA;    exit(1);&#xA;  }&#xA;  ost->id=0;&#xA;&#xA;  ret = avcodec_parameters_from_context(ost->codecpar, out_codec_ctx);&#xA;  if (ret &lt; 0) {&#xA;      av_log(NULL, AV_LOG_ERROR, "Failed to copy encoder parameters to output stream. %s\n",av_err2str(ret));&#xA;      return ret;&#xA;  }&#xA;&#xA;  ost->time_base = out_codec_ctx->time_base;&#xA;&#xA;  av_dump_format(out_format_ctx, 0, output, 1);&#xA;&#xA;  /* copy the stream parameters to the muxer */&#xA;  ret = avcodec_parameters_from_context(ost->codecpar, out_codec_ctx);&#xA;  if (ret &lt; 0) {&#xA;    fprintf(stderr, "Could not copy the stream parameters. %s\n",av_err2str(ret));&#xA;    exit(1);&#xA;  }&#xA;&#xA;  if (!(out_format_ctx->oformat->flags &amp; AVFMT_NOFILE)) {&#xA;      ret = avio_open(&amp;out_format_ctx->pb, output, AVIO_FLAG_WRITE);&#xA;      if (ret &lt; 0) {&#xA;          av_log(NULL, AV_LOG_ERROR, "Could not open output file &#x27;%s&#x27;", output);&#xA;          return ret;&#xA;      }&#xA;  }&#xA;&#xA;  /* init muxer, write output file header */&#xA;  ret = avformat_write_header(out_format_ctx, NULL);&#xA;  if (ret &lt; 0) {&#xA;      av_log(NULL, AV_LOG_ERROR, "Error occurred when opening output file\n");&#xA;      return ret;&#xA;  }&#xA;&#xA;  while(1)&#xA;  {&#xA;    if((ret = av_read_frame(in_format_ctx, &amp;packet)) &lt; 0)&#xA;    {&#xA;      fprintf(stderr, "Reading frame failed. %s\n",av_err2str(ret));&#xA;      break;&#xA;    }&#xA;&#xA;    frame = av_frame_alloc();&#xA;    if (!frame) {&#xA;        ret = AVERROR(ENOMEM);&#xA;        break;&#xA;    }&#xA;&#xA;    av_packet_rescale_ts(&amp;packet,in_format_ctx->streams[0]->time_base,in_codec_ctx->time_base);&#xA;&#xA;    if((ret = avcodec_decode_audio4(in_codec_ctx,frame,&amp;got_frame,&amp;packet)) &lt; 0)&#xA;    {&#xA;      av_frame_free(&amp;frame);&#xA;      fprintf(stderr, "Audio decoding failed. %s\n",av_err2str(ret));&#xA;      break;&#xA;    }&#xA;&#xA;    frame->nb_samples = out_codec_ctx->frame_size;&#xA;    if((ret = av_frame_get_buffer(frame, 0))&lt;0)&#xA;    {&#xA;      fprintf(stderr, "Error allocating an audio buffer. %s\n",av_err2str(ret));&#xA;      break;&#xA;    }&#xA;&#xA;    if(got_frame)&#xA;    {&#xA;      if((ret = avcodec_encode_audio2(out_codec_ctx,&amp;packet,frame,&amp;got_packet)) &lt; 0)&#xA;      {&#xA;        av_frame_free(&amp;frame);&#xA;        fprintf(stderr, "Audio encoding failed. %d %s\n",ret,av_err2str(ret));&#xA;        break;&#xA;      }&#xA;    }&#xA;    av_frame_free(&amp;frame);&#xA;&#xA;    if(got_packet)&#xA;    {&#xA;      if((ret = av_interleaved_write_frame(out_format_ctx,&amp;packet)) &lt; 0)&#xA;      {&#xA;        av_packet_unref(&amp;packet);&#xA;        fprintf(stderr, "Writing frame error. %s\n",av_err2str(ret));&#xA;        break;&#xA;      }&#xA;    }&#xA;    av_packet_unref(&amp;packet);&#xA;  }&#xA;}&#xA;&#xA;

    &#xA;

  • Re-sampling H264 video to reduce frame rate while maintaining high image quality

    4 mars 2019, par BrianTheLion

    Here’s the mplayer output for a video of interest :

    br@carina:/tmp$ mplayer foo.mov
    mplayer: Symbol `ff_codec_bmp_tags' has different size in shared object, consider re-linking
    MPlayer 1.0rc4-4.5.2 (C) 2000-2010 MPlayer Team
    mplayer: could not connect to socket
    mplayer: No such file or directory
    Failed to open LIRC support. You will not be able to use your remote control.

    Playing foo.mov.
    libavformat file format detected.
    [lavf] stream 0: video (h264), -vid 0
    [lavf] stream 1: audio (aac), -aid 0, -alang eng
    VIDEO:  [H264]  1280x720  24bpp  59.940 fps  2494.2 kbps (304.5 kbyte/s)
    ==========================================================================
    Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
    Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
    ==========================================================================
    ==========================================================================
    Opening audio decoder: [faad] AAC (MPEG2/4 Advanced Audio Coding)
    AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 15999->176400)
    Selected audio codec: [faad] afm: faad (FAAD AAC (MPEG-2/MPEG-4 Audio))
    ==========================================================================
    AO: [pulse] 44100Hz 2ch s16le (2 bytes per sample)
    Starting playback...
    Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
    VO: [vdpau] 1280x720 => 1280x720 Planar YV12

    I’d like to use ffmpeg, mencoder, or some other command-line video transcoder to re-sample this video to a lower framerate without loss of image quality. That is, each frame should remain as crisp as possible.

    Attempts

    ffmpeg -i foo.mov -r 25 -vcodec copy bar.mov
    • The target frame rate — 25fps — is achieved but individual frames are "blocky."
    mencoder -nosound -ovc copy foo.mov -ofps 25 -o bar.mov
    • Videos are effectively un-viewable.

    Help !

    This seems like a simple enough use case. I’m very surprised that obvious things are not working. Is there something wrong with my approach ?