Recherche avancée

Médias (0)

Mot : - Tags -/xmlrpc

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

Autres articles (64)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • 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 (6831)

  • Keep trying a command until it returns "True" and then execute another

    6 janvier 2023, par Tyrone Hirt

    I'm trying to make a script to check the processor usage for a specific process every 10 seconds, and when the usage is less than 2% I want another 2 commands to be executed.

    


    The purpose is to know when the program has finished processing the requests, in order to release the execution of the other commands.

    


    I created this script to check the processor usage by this application :

    


    SET ProcessorUsage = wmic path Win32_PerfFormattedData_PerfProc_Process get Name,PercentProcessorTime | findstr /i /c:RenderQuery

%ProcessorUsage%


    


    And these are the commands I want to be executed when the processor usage of the RenderQuery application is less than 2% :

    


    for /f "delims=" %%X in ('dir /s/b/ad Proxy') do for /f "delims=" %%Y in ('dir /s/b/a-d "%%X"') do move "%%Y" ".\03. Proxy"

for /f "delims=" %%i in ('dir /s/b/ad Proxy') do rd "%%i"


    


    I tried to create a script that way here :

    


    SET ProcessorUsage = wmic path Win32_PerfFormattedData_PerfProc_Process get Name,PercentProcessorTime | findstr /i /c:RenderQuery
:Loop
IF %ProcessorUsage% LSS 2 (
(for /f "delims=" %%X in ('dir /s/b/ad Proxy') do for /f "delims=" %%Y in ('dir /s/b/a-d "%%X"') do move "%%Y" ".\03. Proxy") && (for /f "delims=" %%i in ('dir /s/b/ad Proxy') do rd "%%i")
) ELSE (
sleep 10 && goto Loop
)


    


    I also tried this way here :

    


    SET ProcessorUsage = wmic path Win32_PerfFormattedData_PerfProc_Process get Name,PercentProcessorTime | findstr /i /c:RenderQuery

:Loop
for %ProcessorUsage% LSS 2 do (
(for /f "delims=" %%X in ('dir /s/b/ad Proxy') do for /f "delims=" %%Y in ('dir /s/b/a-d "%%X"') do move "%%Y" ".\03. Proxy") && (for /f "delims=" %%i in ('dir /s/b/ad Proxy') do rd "%%i") || (sleep 10 && goto Loop)
)


    


    With these scripts I tried to create the window that only blinks and closes right away...

    


    What's the best way to do this ?

    


    EDIT

    


    Explaining in more detail : I work with video production, so I constantly need to render Proxy files, which are video files with low quality to be used during my video editing and replaced at the end of editing, this makes the much smoother video editing.

    


    Having said that, I have a folder model, inside this folder model there is a folder where I always download the video files from the camera and in that folder there is always a .bat file that opens all the video files in the software that generates proxy files of the camera's video files.

    


    This .bat file has this exact code :

    


    start "" "C:\Users\User\Downloads\FFmpeg_Batch_AV_Converter_Portable_2.8.4_x64\FFBatch.exe" -f "%~dp0\"


    


    When this software opens, it automatically renders the proxy files and their output is always in a child folder of the original files folder, and the name of the folder is Proxy.

    


    The issue is that I don't want them to be in several separate Proxy folders, so I created another .bat file that is in the parent folder of all video files, this script contains exactly these lines :

    


    for /f "delims=" %%X in ('dir /s/b/ad Proxy') do for /f "delims=" %%Y in ('dir /s/b/a-d "%%X"') do move "%%Y" ".\03. Proxy"

for /f "delims=" %%i in ('dir /s/b/ad Proxy') do rd "%%i"


    


    That is, it only searches recursively for files that are inside folders named Proxy, then it moves these files to the folder 03. Proxy that is inside the parent folder.

    


    The second line looks for all proxy folders (which are now empty) and deletes them.

    


    The point is : I currently run the second script manually, as soon as the render finishes, and I would like it to run automatically.

    


    Given this, I thought of adding a line in the first script, which opens the video files in the rendering program, this line would call the second script in the background, and the second script would be analyzing the CPU usage of this application every 10 seconds, and when the usage is less than 2% (in theory there is nothing else rendering, since it has a low CPU usage) it executes the lines that move the files and remove the folders.

    


    I think there's a good change for this to work, because this software renders 4 videos at a time, and this means that there is no time between stopping rendering a video and starting another... the CPU usage is always very high until all the videos are finished, so I think this would be the best signal to release the other commands.

    


  • Google Speech API returns empty result for some FLAC files, and not for the others although they have same codec and sample rate

    15 mars 2021, par Chad

    Below code is what I used to make request for transcription.

    


    import io
from google.cloud import speech_v1p1beta1 as speech
def transcribe_file(speech_file):
    """Transcribe the given audio file."""

    client = speech.SpeechClient()

    encoding = speech.RecognitionConfig.AudioEncoding.FLAC
    if os.path.splitext(speech_file)[1] == ".wav":
        encoding = speech.RecognitionConfig.AudioEncoding.LINEAR16
    with io.open(speech_file, "rb") as audio_file:
        content = audio_file.read()

    audio = speech.RecognitionAudio(content=content)
    config = speech.RecognitionConfig(
        encoding=speech.RecognitionConfig.AudioEncoding.FLAC,
        sample_rate_hertz=32000,
        language_code="ja-JP",
        max_alternatives=3,
        enable_word_time_offsets=True,
        enable_automatic_punctuation=True,
        enable_word_confidence=True,
    )

    response = client.recognize(config=config, audio=audio)
    #print(speech_file, "Recognition Done")
    return response


    


    As I wrote in title, the results of response has empty list for some files, and not for some files.
They have same sample rate and codec(32000, FLAC)

    


    Below is the result of ffprobe -i "AUDIOFILE" -show_streams for one of each cases.

    


    Left one is empty one. The only difference is duration of file.

    


    How can I get non empty results ?

    


    Result of ffprobe

    


    Edit :

    


    Result of ffprobe show stream show format

    


    Something not captured in one screen

    


    Sadly, re-mux didn't work.

    


    I used ffmpeg-git-20210225

    


    ffbrobe result of broken one

    


    ./ffprobe -show_streams -show_format broken.flac 
ffprobe version N-56320-ge937457b7b-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      56. 66.100 / 56. 66.100
  libavcodec     58.125.101 / 58.125.101
  libavformat    58. 68.100 / 58. 68.100
  libavdevice    58. 12.100 / 58. 12.100
  libavfilter     7.107.100 /  7.107.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Input #0, flac, from 'broken.flac':
  Metadata:
    encoder         : Lavf58.45.100
  Duration: 00:00:00.90, start: 0.000000, bitrate: 342 kb/s
  Stream #0:0: Audio: flac, 32000 Hz, mono, s16
[STREAM]
index=0
codec_name=flac
codec_long_name=FLAC (Free Lossless Audio Codec)
profile=unknown
codec_type=audio
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
sample_fmt=s16
sample_rate=32000
channels=1
channel_layout=mono
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/32000
start_pts=0
start_time=0.000000
duration_ts=28672
duration=0.896000
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=16
nb_frames=N/A
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=broken.flac
nb_streams=1
nb_programs=0
format_name=flac
format_long_name=raw FLAC
start_time=0.000000
duration=0.896000
size=38362
bit_rate=342517
probe_score=100
TAG:encoder=Lavf58.45.100
[/FORMAT]


    


    ffprobe result of non_broken one

    


    ./ffprobe -show_streams -show_format non_broken.flac 
ffprobe version N-56320-ge937457b7b-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      56. 66.100 / 56. 66.100
  libavcodec     58.125.101 / 58.125.101
  libavformat    58. 68.100 / 58. 68.100
  libavdevice    58. 12.100 / 58. 12.100
  libavfilter     7.107.100 /  7.107.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Input #0, flac, from 'non_broken.flac':
  Metadata:
    encoder         : Lavf58.45.100
  Duration: 00:00:00.86, start: 0.000000, bitrate: 358 kb/s
  Stream #0:0: Audio: flac, 32000 Hz, mono, s16
[STREAM]
index=0
codec_name=flac
codec_long_name=FLAC (Free Lossless Audio Codec)
profile=unknown
codec_type=audio
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
sample_fmt=s16
sample_rate=32000
channels=1
channel_layout=mono
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/32000
start_pts=0
start_time=0.000000
duration_ts=27648
duration=0.864000
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=16
nb_frames=N/A
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=non_broken.flac
nb_streams=1
nb_programs=0
format_name=flac
format_long_name=raw FLAC
start_time=0.000000
duration=0.864000
size=38701
bit_rate=358342
probe_score=100
TAG:encoder=Lavf58.45.100
[/FORMAT]


    


    And the result of ffmpeg -f lavfi -i sine=d=0.864:r=32000 output.flac

    


    ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, lavfi, from 'sine=d=0.864:r=32000':
  Duration: N/A, start: 0.000000, bitrate: 512 kb/s
    Stream #0:0: Audio: pcm_s16le, 32000 Hz, mono, s16, 512 kb/s
File 'output.flac' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> flac (native))
Press [q] to stop, [?] for help
Output #0, flac, to 'output.flac':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0: Audio: flac, 32000 Hz, mono, s16, 128 kb/s
    Metadata:
      encoder         : Lavc57.107.100 flac
[Parsed_sine_0 @ 0x55c317ddda00] EOF timestamp not reliable
size=      16kB time=00:00:00.86 bitrate= 154.0kbits/s speed= 205x    
video:0kB audio:8kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 99.364586%


    


  • FFMpeg Coding in C : Encoder returns EOF at first interaction. Encoder not opened correctly ? [closed]

    26 février, par Davidhohey

    as I'm fairly new to FFMpeg Programming and C in general, the code looks like a mess.

    


    I have smashed my head against a wall trying to get this code to work for about a week.

    


    int decode_encode_pipeline(AVFormatContext *Input_Format_Context, AVFormatContext *Output_Format_Context, int *streams_list){

    const AVCodec *DECodec, *ENCodec;
    AVCodecContext *DECodecContext = NULL, *ENCodecContext = NULL;
    AVCodecParameters *CodecParameters = NULL;
    AVDictionary *opts = NULL;
    AVPacket *Packet;
    AVFrame *Frame;
    int check;

    Packet = av_packet_alloc();
    if(!Packet){
    
        printf("\nFehler bei Allocating Packet");
    
        return 0;
    
    }

    Frame = av_frame_alloc();
    if(!Frame){
    
        printf("\nFehler bei Allocating Frame");
    
        return 0;
    
    }

    CodecParameters = Input_Format_Context->streams[Packet->stream_index]->codecpar;
    if(!CodecParameters){

        printf("\nCodecParameters konnte nicht erstellt oder zugewiesen werden.");

    }

    DECodec = avcodec_find_decoder(CodecParameters->codec_id);
    if(!DECodec){
    
        printf("\nCodec nicht gefunden");
    
        return 0;
    
    }

    DECodecContext = avcodec_alloc_context3(DECodec);
    if (!DECodecContext){
    
        printf("\nFehler bei Allocating CodecContext");
    
        return 0;
    
    }

    ENCodec = avcodec_find_encoder(CodecParameters->codec_id);
    if(!DECodec){
    
        printf("\nCodec nicht gefunden");
    
        return 0;
    
    }

    ENCodecContext = avcodec_alloc_context3(ENCodec);
    if (!ENCodecContext){
    
        printf("\nFehler bei Allocating CodecContext");
    
        return 0;
    
    }

    check = avformat_write_header(Output_Format_Context, &opts);
    if(check < 0){

        printf("\nFehler beim Öffnen des Output Files.");
        
        return 1;

    }

    avcodec_parameters_to_context(DECodecContext, CodecParameters);
    avcodec_parameters_to_context(ENCodecContext, CodecParameters);

    ENCodecContext->width = DECodecContext->width;
    ENCodecContext->height = DECodecContext->height;
    ENCodecContext->bit_rate = DECodecContext->bit_rate;
    ENCodecContext->time_base = (AVRational){1, 30};
    ENCodecContext->framerate = DECodecContext->framerate;
    ENCodecContext->gop_size = DECodecContext->gop_size;
    ENCodecContext->max_b_frames = DECodecContext->max_b_frames;
    ENCodecContext->pix_fmt = DECodecContext->pix_fmt;
    if(ENCodec->id == AV_CODEC_ID_H264){

        av_opt_set(ENCodecContext->priv_data, "preset", "slow", 0);

    }

    check = avcodec_open2(DECodecContext, DECodec, NULL);
    if(check < 0){
    
        printf("\nFehler bei Öffnen von DECodec");
    
        return 1;
    
    }

    check = avcodec_open2(ENCodecContext, ENCodec, NULL);
    if(check < 0){
    
        printf("\nFehler bei Öffnen von ENCodec");
    
        return 1;
    
    }

    while(1){
    
        check = av_read_frame(Input_Format_Context, Packet);
        if(check < 0){
        
            break;
        
        }

        AVStream *in_stream, *out_stream;

        in_stream  = Input_Format_Context->streams[Packet->stream_index];
        out_stream = Output_Format_Context->streams[Packet->stream_index];

        if(in_stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && Packet->stream_index == streams_list[Packet->stream_index]){

            check = avcodec_send_packet(DECodecContext, Packet);
            if(check < 0){

                printf("\nFehler bei Encoding");

                return 1;

            }

            AVPacket *EncodedPacket;
            EncodedPacket = av_packet_alloc();
            if(!EncodedPacket){
        
                printf("\nFehler bei Allocating Packet");
        
                return 1;
        
            }

            /*While Loop Decoding*/
            while(check >= 0){
    
                check = avcodec_receive_frame(DECodecContext, Frame);
                if(check == AVERROR(EAGAIN)){
        
                    continue;
        
                }else if(check == AVERROR_EOF){
                    
                    break;
                    
                }else if(check < 0){
        
                    printf("\nFehler bei Decoding");
        
                    return 1;
        
                }

                /*Convert Colorspace*/
                struct SwsContext *SwsContexttoRGB = sws_getContext(Frame->width, Frame->height, Frame->format, Frame->width, Frame->height, AV_PIX_FMT_RGB24, SWS_BILINEAR, NULL, NULL, NULL);
                struct SwsContext *SwsContexttoOriginal = sws_getContext(Frame->width, Frame->height, AV_PIX_FMT_RGB24, Frame->width, Frame->height, Frame->format, SWS_BILINEAR, NULL, NULL, NULL);
                if(!SwsContexttoRGB || !SwsContexttoOriginal){

                    printf("\nSwsContext konnte nicht befüllt werden.");

                    return 1;

                }   

                if(Frame->linesize < 0){

                    printf("\nFehler: linesize ist negativ und nicht kompatibel\n");

                    return 1;

                }

                AVFrame *RGBFrame;
                RGBFrame = av_frame_alloc();
                if(!RGBFrame){

                    printf("\nFehler bei der Reservierung für den RGBFrame");

                    return 1;

                }
                /*
                int number_bytes = av_image_get_buffer_size(AV_PIX_FMT_RGB24, Frame->width, Frame->height, 1);
                if(number_bytes < 0){

                    printf("\nFehler bei der Berechnung der benoetigten Bytes fuer Konvertierung");

                    return 1;

                }
                
                uint8_t *rgb_buffer = (uint8_t *)av_malloc(number_bytes*sizeof(uint8_t));
                if(rgb_buffer == NULL){

                    printf("\nFehler bei der Reservierung für den RGBBuffer");

                    return 1;

                }

                check = av_image_fill_arrays(RGBFrame->data, RGBFrame->linesize, rgb_buffer, AV_PIX_FMT_RGB24, Frame->width, Frame->height, 1);
                if(check < 0){

                    printf("\nFehler bei der Zuweisung der RGB Daten");

                    return 1;

                }*/

                //sws_scale(SwsContexttoRGB, (const uint8_t * const *)Frame->data, Frame->linesize, 0, Frame->height, RGBFrame->data, RGBFrame->linesize);
                sws_scale_frame(SwsContexttoRGB, Frame, RGBFrame);
                printf("\nIch habe die Daten zu RGB konvertiert.");

                //sws_scale(SwsContexttoOriginal, (const uint8_t * const *)RGBFrame->data, RGBFrame->linesize, 0, Frame->height, Frame->data, Frame->linesize);
                sws_scale_frame(SwsContexttoOriginal, RGBFrame, Frame);
                printf("\nIch habe die Daten zurück ins Original konvertiert.");

                Frame->format = ENCodecContext->pix_fmt;
                Frame->width  = ENCodecContext->width;
                Frame->height = ENCodecContext->height;
                
                check = av_frame_get_buffer(Frame, 0);
                if(check < 0){
        
                    printf("\nFehler bei Allocating Frame Buffer");
        
                    return 1;
        
                }

                /* Encoding */
                check = av_frame_make_writable(Frame);
                if(check < 0){

                    printf("\nFehler bei Make Frame Writable");

                    return 1;

                }

                encode(ENCodecContext, Frame, EncodedPacket, Output_Format_Context);

                sws_freeContext(SwsContexttoRGB);
                sws_freeContext(SwsContexttoOriginal);
                av_frame_free(&RGBFrame);
                //av_free(rgb_buffer);

            }

            /* Flushing Encoder */
            encode(ENCodecContext, NULL, EncodedPacket, Output_Format_Context);

            //avcodec_flush_buffers(DECodecContext);
            //avcodec_flush_buffers(ENCodecContext);

            av_packet_free(&EncodedPacket);

        }else{

            av_interleaved_write_frame(Output_Format_Context, Packet);

        }

    }

    av_write_trailer(Output_Format_Context); 

    /* Memory Free */
    avcodec_free_context(&DECodecContext);
    avcodec_free_context(&ENCodecContext);
    avcodec_parameters_free(&CodecParameters);
    av_frame_free(&Frame);
    av_packet_free(&Packet);

    return 0;

}



    


    The function encode looks as follows :

    


    static void encode(AVCodecContext *ENCodecContext, AVFrame *Frame, AVPacket *EncodedPacket, AVFormatContext *Output_Format_Context){

    int check;



    check = avcodec_send_frame(ENCodecContext, Frame);
    if(check == AVERROR(EAGAIN)){
        printf("\nEAGAIN");
    } 
    if(check == AVERROR_EOF){
        printf("\nEOF");
    }
    if(check == AVERROR(EINVAL)){
        printf("\nEINVAL");
    }
    if(check == AVERROR(ENOMEM)){
        printf("\nENOMEM");
    }
    if(check < 0){

        printf("\nFehler bei Encoding Send Frame. Check = %d", check);

        return;

    }

    while(check >= 0){

        check = avcodec_receive_packet(ENCodecContext, EncodedPacket);
        if(check == AVERROR(EAGAIN) || check == AVERROR_EOF){

            return;

        }else if(check < 0){

            printf("\nFehler bei Encoding");

            return;

        }

        if (av_interleaved_write_frame(Output_Format_Context, EncodedPacket) < 0) {

            printf("\nFehler beim Muxen des Paketes.");
            break;

        }

        av_packet_unref(EncodedPacket);

    }

    return;

}


    


    The program should decode a video into the individual frames convert them to RGB24, so I can work with the raw data of the frame, then convert it back to the original format and encode the frames.

    


    The encoder doesn't play nice, as I get an EOF error at avcodec_send_frame().
But I couldn't figure it out why the encoder behaves like this.
And yes I have read the docs and example files, but either I'm massivly missing a crucial detail or I'm just ****.

    


    Any and all help will be and is massivly appreciated.

    


    PS. : The used libraries are libavutil, libavformat, libavcodec, libswscale. All installed with the "-dev" suffix through linux commandline. Should all be the version 7.0 libraries.

    


    Thanks in advance.
With best regards.

    


      

    • Read the docs
    • 


    • Shifting the encoding step out of the decoding while loop
    •