Recherche avancée

Médias (91)

Autres articles (65)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • MediaSPIP Core : La Configuration

    9 novembre 2010, par

    MediaSPIP Core fournit par défaut trois pages différentes de configuration (ces pages utilisent le plugin de configuration CFG pour fonctionner) : une page spécifique à la configuration générale du squelettes ; une page spécifique à la configuration de la page d’accueil du site ; une page spécifique à la configuration des secteurs ;
    Il fournit également une page supplémentaire qui n’apparait que lorsque certains plugins sont activés permettant de contrôler l’affichage et les fonctionnalités spécifiques (...)

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

Sur d’autres sites (11801)

  • DivX audio not decoded on DVD player

    8 août 2019, par Shaul

    Moved to https://video.stackexchange.com/questions/28225/divx-audio-not-decoded-on-dvd-player

    I am converting MP4 movie into AVI/DivX format. I plan to copy the AVI to a USB memory stick and plug it into my DVD player. My player is a Pioneer 3052 that supports USB input.

    I convert the file using ffmpeg without error messages. The output file is played correctly on my computer, including audio. I use "Movies & TVs" and "DIVX Player" for testing.

    When I try running it on my Pioneer the video and the subtitles are ok but there’s no audio. I know that there’s no issues with the hardware because videos converted with "FreeMake Video converter" do play audio.

    My command line is :

    .\ffmpeg.exe  "-i INFILE -c:v mpeg4 -vtag xvid -qscale:v 3 -c:a libmp3lame  -vf "scale=720:576:force_original_aspect_ratio=decrease,pad=720:576:(ow-iw)/2:(oh-ih)/2","subtitles=f=SRTFILE:charenc=ISO-8859-8:force_style=PrimaryColour=&H0000FFFF,Fontsize=16" OUTFILE

    I also experimented with -b:a 192k, -b:a 96k and -qscale:a 4 all leading to the same results.

    I wander what else to try.
    I add the report produced by ffprobe (for the output file) :

    [STREAM]
    index=0
    codec_name=mpeg4
    codec_long_name=MPEG-4 part 2
    profile=Simple Profile
    codec_type=video
    codec_time_base=1001/24000
    codec_tag_string=xvid
    codec_tag=0x64697678
    width=720
    height=576
    coded_width=720
    coded_height=576
    has_b_frames=0
    sample_aspect_ratio=1:1
    display_aspect_ratio=5:4
    pix_fmt=yuv420p
    level=1
    color_range=unknown
    color_space=unknown
    color_transfer=unknown
    color_primaries=unknown
    chroma_location=left
    field_order=unknown
    timecode=N/A
    refs=1
    quarter_sample=false
    divx_packed=false
    id=N/A
    r_frame_rate=24000/1001
    avg_frame_rate=24000/1001
    time_base=1001/24000
    start_pts=0
    start_time=0.000000
    duration_ts=163203
    duration=6806.925125
    bit_rate=1243432
    max_bit_rate=N/A
    bits_per_raw_sample=N/A
    nb_frames=163203
    nb_read_frames=N/A
    nb_read_packets=N/A
    DISPOSITION:default=0
    DISPOSITION:dub=0
    DISPOSITION:original=0
    DISPOSITION:comment=0
    DISPOSITION:lyrics=0
    DISPOSITION:karaoke=0
    DISPOSITION:forced=0
    DISPOSITION:hearing_impaired=0
    DISPOSITION:visual_impaired=0
    DISPOSITION:clean_effects=0
    DISPOSITION:attached_pic=0
    DISPOSITION:timed_thumbnails=0
    [/STREAM]
    [STREAM]
    index=1
    codec_name=mp3
    codec_long_name=MP3 (MPEG audio layer 3)
    profile=unknown
    codec_type=audio
    codec_time_base=1/48000
    codec_tag_string=U[0][0][0]
    codec_tag=0x0055
    sample_fmt=fltp
    sample_rate=48000
    channels=2
    channel_layout=stereo
    bits_per_sample=0
    id=N/A
    r_frame_rate=0/0
    avg_frame_rate=0/0
    time_base=3/125
    start_pts=0
    start_time=0.000000
    duration_ts=283622
    duration=6806.928000
    bit_rate=192000
    max_bit_rate=N/A
    bits_per_raw_sample=N/A
    nb_frames=283622
    nb_read_frames=N/A
    nb_read_packets=N/A
    DISPOSITION:default=0
    DISPOSITION:dub=0
    DISPOSITION:original=0
    DISPOSITION:comment=0
    DISPOSITION:lyrics=0
    DISPOSITION:karaoke=0
    DISPOSITION:forced=0
    DISPOSITION:hearing_impaired=0
    DISPOSITION:visual_impaired=0
    DISPOSITION:clean_effects=0
    DISPOSITION:attached_pic=0
    DISPOSITION:timed_thumbnails=0
    [/STREAM]
    [FORMAT]
    filename=H:\Movies\Memento.avi
    nb_streams=2
    nb_programs=0
    format_name=avi
    format_long_name=AVI (Audio Video Interleaved)
    start_time=0.000000
    duration=6806.928000
    size=1235006020
    bit_rate=1451469
    probe_score=100
    TAG:encoder=Lavf58.20.100
    [/FORMAT]

    EDIT :
    I add an example of a movie that is OK on this DVD player :

    [STREAM]
    index=0
    codec_name=mpeg4
    codec_long_name=MPEG-4 part 2
    profile=Advanced Simple Profile
    codec_type=video
    codec_time_base=1001/24000
    codec_tag_string=XVID
    codec_tag=0x44495658
    width=576
    height=432
    coded_width=576
    coded_height=432
    has_b_frames=1
    sample_aspect_ratio=1:1
    display_aspect_ratio=4:3
    pix_fmt=yuv420p
    level=5
    color_range=unknown
    color_space=unknown
    color_transfer=unknown
    color_primaries=unknown
    chroma_location=left
    field_order=unknown
    timecode=N/A
    refs=1
    quarter_sample=false
    divx_packed=false
    id=N/A
    r_frame_rate=24000/1001
    avg_frame_rate=24000/1001
    time_base=1001/24000
    start_pts=0
    start_time=0.000000
    duration_ts=134521
    duration=5610.646708
    bit_rate=943851
    max_bit_rate=N/A
    bits_per_raw_sample=N/A
    nb_frames=134521
    nb_read_frames=N/A
    nb_read_packets=N/A
    DISPOSITION:default=0
    DISPOSITION:dub=0
    DISPOSITION:original=0
    DISPOSITION:comment=0
    DISPOSITION:lyrics=0
    DISPOSITION:karaoke=0
    DISPOSITION:forced=0
    DISPOSITION:hearing_impaired=0
    DISPOSITION:visual_impaired=0
    DISPOSITION:clean_effects=0
    DISPOSITION:attached_pic=0
    DISPOSITION:timed_thumbnails=0
    [/STREAM]
    [STREAM]
    index=1
    codec_name=mp3
    codec_long_name=MP3 (MPEG audio layer 3)
    profile=unknown
    codec_type=audio
    codec_time_base=1/48000
    codec_tag_string=U[0][0][0]
    codec_tag=0x0055
    sample_fmt=fltp
    sample_rate=48000
    channels=2
    channel_layout=stereo
    bits_per_sample=0
    id=N/A
    r_frame_rate=0/0
    avg_frame_rate=0/0
    time_base=3/125
    start_pts=0
    start_time=0.000000
    duration_ts=233777
    duration=5610.648000
    bit_rate=91176
    max_bit_rate=N/A
    bits_per_raw_sample=N/A
    nb_frames=233777
    nb_read_frames=N/A
    nb_read_packets=N/A
    DISPOSITION:default=0
    DISPOSITION:dub=0
    DISPOSITION:original=0
    DISPOSITION:comment=0
    DISPOSITION:lyrics=0
    DISPOSITION:karaoke=0
    DISPOSITION:forced=0
    DISPOSITION:hearing_impaired=0
    DISPOSITION:visual_impaired=0
    DISPOSITION:clean_effects=0
    DISPOSITION:attached_pic=0
    DISPOSITION:timed_thumbnails=0
    [/STREAM]
    [FORMAT]
    filename=H:\Honey.I.Shrunk.The.Kids.1989.FS.DVDRip.XViD.iNT-EwDp.HebSub.www.Moridim.tv.avi
    nb_streams=2
    nb_programs=0
    format_name=avi
    format_long_name=AVI (Audio Video Interleaved)
    start_time=0.000000
    duration=5610.648000
    size=734808064
    bit_rate=1047733
    probe_score=100
    TAG:encoder=VirtualDubMod 1.5.10.2 (build 2540/release)
    [/FORMAT]
  • Trying to decode and encode audio files with the FFMPEG C API

    1er février 2023, par Giulio Iacomino

    My ultimate goal will be to split multi channel WAV files into single mono ones, after few days of experiments my plan is the sequence :

    


      

    1. Decode audio file into a frame.
    2. 


    3. Convert interleaved frame into a planar one. (in order to separate the data buffer into multiple ones)
    4. 


    5. Grab the planar frame buffers and encode each of them into a new file.
    6. 


    


    So far I'm stuck trying to convert a wav file from interleaved to a planar one, and reprint the wav file.

    


    edit :
I've turned on guard malloc and apparently the error is within the convert function

    


    Here's the code :

    


    AVCodecContext* initializeAndOpenCodecContext(AVFormatContext* formatContext, AVStream* stream){
     // grab our stream, most audio files only have one anyway
    const AVCodec* decoder = avcodec_find_decoder(stream->codecpar->codec_id);
    if (!decoder){
        std::cout << "no decoder, can't go ahead!\n";
        return nullptr;
    }
    AVCodecContext* codecContext = avcodec_alloc_context3(decoder);
    avcodec_parameters_to_context(codecContext, stream->codecpar);
    int err = avcodec_open2(codecContext, decoder, nullptr);
    if (err < 0){
        std::cout << "couldn't open codex!\n";
    }
    return codecContext;
}

void initialiseResampler(SwrContext* resampler, AVFrame* inputFrame, AVFrame* outputFrame){
    av_opt_set_chlayout(resampler, "in_channel_layout", &inputFrame->ch_layout, 0);
    av_opt_set_chlayout(resampler, "out_channel_layout", &outputFrame->ch_layout, 0);
    av_opt_set_int(resampler, "in_sample_fmt", inputFrame->format, 0);
    av_opt_set_int(resampler, "out_sample_fmt", AV_SAMPLE_FMT_FLTP, 0);
    av_opt_set_int(resampler, "in_sample_rate", inputFrame->sample_rate, 0);
    av_opt_set_int(resampler, "out_sample_rate", outputFrame->sample_rate, 0);
}

AVFrame* initialisePlanarFrame(AVFrame* frameToInit, AVFrame* inputFrame){
    //AVFrame *planar_frame = av_frame_alloc();
    frameToInit->nb_samples = inputFrame->nb_samples;
    frameToInit->ch_layout = inputFrame->ch_layout;
    frameToInit->format = AV_SAMPLE_FMT_FLTP;
    frameToInit->sample_rate = inputFrame->sample_rate;
    return nullptr;
}

int main() {
    AVCodecContext *codingContext= NULL;
    const AVCodec *codec;
    codec = avcodec_find_encoder(AV_CODEC_ID_PCM_F32LE);
    codingContext = avcodec_alloc_context3(codec);
    codingContext->bit_rate = 16000;
    codingContext->sample_fmt = AV_SAMPLE_FMT_FLT;
    codingContext->sample_rate = 48000;
    codingContext->ch_layout.nb_channels = 2;
    codingContext->ch_layout.order = (AVChannelOrder)0;
    uint8_t **buffer_ = NULL;
    AVFrame* planar_frame = NULL;
    
    // open input
    AVFormatContext* formatContext = nullptr;
    int err = avformat_open_input(&formatContext, "/Users/tonytorm/Desktop/drum kits/DECAP - Drums That Knock Vol. 9/Kicks/Brash Full Metal Kick.wav", nullptr, nullptr);
    if (err < 0){
        fprintf(stderr, "Unable to open file!\n");
        return;
    }

    // find audio stream
    err = avformat_find_stream_info(formatContext, nullptr);
    if (err > 0){
        fprintf(stderr, "Unable to retrieve stream info!\n");
        return;
    }
    
    int index = av_find_best_stream(formatContext, AVMEDIA_TYPE_AUDIO, -1, -1, nullptr, 0);
    if (index < 0){
        std::cout<<  "coudn't find audio stream in this file" << '\n';
    }
    AVStream* stream = formatContext->streams[index];
    
    auto fileName = "/Users/tonytorm/Desktop/newFile.wav";
    FILE* newFile = fopen(fileName, "w+");
    
    // find right codec and open it
    if (auto openCodecContext = initializeAndOpenCodecContext(formatContext, stream)){
        AVPacket* packet = av_packet_alloc();
        AVFrame* frame = av_frame_alloc();
        AVFrame* planar_frame = av_frame_alloc();
        SwrContext *avr = swr_alloc();  //audio resampling context
        AVChannelLayout monoChannelLayout{(AVChannelOrder)0};
        monoChannelLayout.nb_channels = 2;
        

        while (!av_read_frame(formatContext, packet)){
            if (packet->stream_index != stream->index) continue;  // we only care about audio
            int ret = avcodec_send_packet(openCodecContext, packet);
            if ( ret < 0) {
                if (ret != AVERROR(EAGAIN)){   // if error is actual error not EAGAIN
                    std::cout << "can't do shit\n";
                    return;
                }
            }
            while (int bret = avcodec_receive_frame(openCodecContext, frame) == 0){
                initialisePlanarFrame(planar_frame, frame);
                
   
                
                int buffer_size_in = av_samples_get_buffer_size(nullptr,
                                                                frame->ch_layout.nb_channels,
                                                                frame->nb_samples,
                                                                (AVSampleFormat)frame->format,
                                                                0);
                int buffer_size_out = buffer_size_in/frame->ch_layout.nb_channels;

                //planar_frame->linesize[0] = buffer_size_out;
                
                int ret = av_samples_alloc(planar_frame->data,
                                           NULL,
                                           planar_frame->ch_layout.nb_channels,
                                           planar_frame->nb_samples,
                                           AV_SAMPLE_FMT_FLTP,
                                           0);
                
                initialiseResampler(avr, frame, planar_frame);
                if (int errRet = swr_init(avr) < 0) {
                    fprintf(stderr, "Failed to initialize the resampling context\n");
                }

                if (ret < 0){
                    char error_message[AV_ERROR_MAX_STRING_SIZE];
                    av_strerror(ret, error_message, AV_ERROR_MAX_STRING_SIZE);
                    fprintf(stderr, "Error allocating sample buffer: %s\n", error_message);
                    return -1;
                }
                
                int samples_converted = swr_convert(avr,
                                                    planar_frame->data,
                                                    buffer_size_out,
                                                    (const uint8_t **)frame->data,
                                                    buffer_size_in);
                if (samples_converted < 0) {
                    // handle error
                    std::cout << "error in conversion\n";
                    return;
                }
                if (avcodec_open2(codingContext, codec, NULL) < 0) {
                    std::cout << "can't encode!\n";
                    return;
                }
                AVPacket* nu_packet = av_packet_alloc();
                while (int copy = avcodec_send_frame(codingContext, planar_frame) != 0){
                    if (copy == AVERROR(EAGAIN) || copy == AVERROR_EOF){
                        std::cout << "can't encode file\n";
                        return;
                    }
                    if (avcodec_receive_packet(codingContext, nu_packet) >=0){
                        fwrite(nu_packet->data, 4, nu_packet->size, newFile);
                        //av_write_frame(avc, nu_packet);
                    }
                }
                av_freep(planar_frame->data);
                av_frame_unref(frame);
                av_frame_unref(planar_frame);
            }
//            av_packet_free(&packet);
//            av_packet_free(&nu_packet);
        }
        swr_free(&avr);
        avcodec_free_context(&codingContext);
        
    }
    fclose(newFile);
}


    


    I know i should write a header to the new wave file but for now I'm just trying to write the raw audio data. I'm getting always the same error but in different parts of the code (randomly), sometimes the code even compiles (writing the raw audio data, but filling it with some rubbish as well, i end up with a data file that is thrice the original one, sometimes i end up with a slightly smaller file - i guess the raw audio without the headers), results are basically random.

    


    Here are some of the functions that trigger the error :

    


    int ret = av_samples_alloc(); //(this the most common one)
swr_convert()
av_freep();


    


    the error is :

    


    main(64155,0x101b5d5c0) malloc: Incorrect checksum for freed object 0x106802600: probably modified after being freed.
Corrupt value: 0x0
main(64155,0x101b5d5c0) malloc: *** set a breakpoint in malloc_error_break to debug */


    


  • VP8 Codec Optimization Update

    16 juin 2010, par noreply@blogger.com (John Luther) — inside webm

    Since WebM launched in May, the team has been working hard to make the VP8 video codec faster. Our community members have contributed improvements, but there’s more work to be done in some interesting areas related to performance (more on those below).


    Encoder


    The VP8 encoder is ripe for speed optimizations. Scott LaVarnway’s efforts in writing an x86 assembly version of the quantizer will help in this goal significantly as the quantizer is called many times while the encoder makes decisions about how much detail from the image will be transmitted.

    For those of you eager to get involved, one piece of low-hanging fruit is writing a SIMD version of the ARNR temporal filtering code. Also, much of the assembly code only makes use of the SSE2 instruction set, and there surely are newer extensions that could be made use of. There are also redundant code removal and other general cleanup to be done ; (Yaowu Xu has submitted some changes for these).

    At a higher level, someone can explore some alternative motion search strategies in the encoder. Eventually the motion search can be decoupled entirely to allow motion fields to be calculated elsewhere (for example, on a graphics processor).

    Decoder


    Decoder optimizations can bring higher resolutions and smoother playback to less powerful hardware.

    Jeff Muizelaar has submitted some changes which combine the IDCT and summation with the predicted block into a single function, helping us avoid storing the intermediate result, thus reducing memory transfers and avoiding cache pollution. This changes the assembly code in a fundamental way, so we will need to sync the other platforms up or switch them to a generic C implementation and accept the performance regression. Johann Koenig is working on implementing this change for ARM processors, and we’ll merge these changes into the mainline soon.

    In addition, Tim Terriberry is attacking a different method of bounds checking on the "bool decoder." The bool decoder is performance-critical, as it is called several times for each bit in the input stream. The current code handles this check with a simple clamp in the innermost loops and a less-frequent copy into a circular buffer. This can be expensive at higher data rates. Tim’s patch removes the circular buffer, but uses a more complex clamp in the innermost loops. These inner loops have historically been troublesome on embedded platforms.

    To contribute in these efforts, I’ve started working on rewriting higher-level parts of the decoder. I believe there is an opportunity to improve performance by paying better attention to data locality and cache layout, and reducing memory bus traffic in general. Another area I plan to explore is improving utilization in the multi-threaded decoder by separating the bitstream decoding from the rest of the image reconstruction, using work units larger than a single macroblock, and not tying functionality to a specific thread. To get involved in these areas, subscribe to the codec-devel mailing list and provide feedback on the code as it’s written.

    Embedded Processors


    We want to optimize multiple platforms, not just desktops. Fritz Koenig has already started looking at the performance of VP8 on the Intel Atom platform. This platform need some attention as we wrote our current x86 assembly code with an out-of-order processor in mind. Since Atom is an in-order processor (much like the original Pentium), the instruction scheduling of all of the x86 assembly code needs to be reexamined. One option we’re looking at is scheduling the code for the Atom processor and seeing if that impacts the performance on other x86 platforms such as the Via C3 and AMD Geode. This is shaping up to be a lot of work, but doing it would provide us with an opportunity to tighten up our assembly code.

    These issues, along with wanting to make better use of the larger register file on x86_64, may reignite every assembly programmer’s (least ?) favorite debate : whether or not to use intrinsics. Yunqing Wang has been experimenting with this a bit, but initial results aren’t promising. If you have experience in dealing with a lot of assembly code across several similar-but-kinda-different platforms, these maintainability issues might be familiar to you. I hope you’ll share your thoughts and experiences on the codec-devel mailing list.

    Optimizing codecs is an iterative (some would say never-ending) process, so stay tuned for more posts on the progress we’re making, and by all means, start hacking yourself.

    It’s exciting to see that we’re starting to get substantial code contributions from developers outside of Google, and I look forward to more as WebM grows into a strong community effort.

    John Koleszar is a software engineer at Google.