Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Relja Ljubobratovic
    @ljubobratovicrelja
    Would you paste the code of creating a SwsContext, and then after using the sws_scale?
    Aaron Yeoh Cruz
    @hyperum
    Okay, sure.
    Relja Ljubobratovic
    @ljubobratovicrelja
    If this what I sad above does not solve your problem, I'm not sure I can guess further without seeing the code
    Aaron Yeoh Cruz
    @hyperum
    imageConversionContext = sws_getCachedContext(null, cameraCodecContext.width, cameraCodecContext.height, cameraCodecContext.pix_fmt, cameraCodecContext.width, cameraCodecContext.height, AVPixelFormat.AV_PIX_FMT_BGR24, SWS_BICUBIC, null, null, null);
        if (imageConversionContext == null) return;
    What do you mean by after using sws_scale?
    av_free_packet(&packet);/sws_freeContext(img_convert_ctx);
    Relja Ljubobratovic
    @ljubobratovicrelja
    sorry, not after - where you use the sws_scale
    Aaron Yeoh Cruz
    @hyperum
    Okay.
                    if(av_read_frame(cameraFormatContext, &cameraPacket)>=0)
            {
                if(cameraPacket.stream_index == cameraVideo)
                {
                    avcodec_decode_video2(cameraCodecContext, rawFrame, &isFrameFinished, &cameraPacket);
    
                    if(isFrameFinished)
                    {
                        if(rawFrame.data.ptr == null || rawFrame.linesize.ptr == null || convertedFrame.data.ptr == null || convertedFrame.linesize.ptr == null) return;
                        sws_scale(imageConversionContext, rawFrame.data, rawFrame.linesize, 0, cameraCodecContext.height, data, linesize);
                        video.loadData(convertedFrame.data[0], 1280, 720, 2);
                    }
                }
            }
    Relja Ljubobratovic
    @ljubobratovicrelja
    and you're sure the data and the linesize are ok?
    By ok, I mean they are formated as:
    const rowStride = width*3;
    const bufferSize = height*rowStride;
    ubyte *[] data = [ new ubyte[rowStride] ];
    int [] linesize = [ rowstride ];
    Aaron Yeoh Cruz
    @hyperum
    Is this fine?
    int rowStride = cameraCodecContext.width * 3;
    int bufferSize = cameraCodecContext.height * rowStride;
    ubyte*[] data = [new ubyte[rowStride].ptr];
    int[] linesize = [rowStride];
    Relja Ljubobratovic
    @ljubobratovicrelja
    yep, I think it is..
    still got the error?
    Aaron Yeoh Cruz
    @hyperum
    I'll create a small test project to solely test this problem.
    For now, I need to be doing other things. Sorry for the wait.
    Relja Ljubobratovic
    @ljubobratovicrelja
    Yep, that's smart
    no problem man
    good luck!
    Aaron Yeoh Cruz
    @hyperum
    Thank you.
    Relja Ljubobratovic
    @ljubobratovicrelja
    ;)
    Aaron Yeoh Cruz
    @hyperum

    Hmm. Do you see anything wrong with this piece of code in particular?

    https://gist.github.com/aaronhyperum/1ba524f9f21b66b2973a752d50b888cc

    I've checked it against a tutorial in C++ online, it seems to be basically identical (except this one doesn't work).
    Aaron Yeoh Cruz
    @hyperum
    I suppose for now I must deal with displaying webcam video in red and green (GL_RG) ;-)
    Relja Ljubobratovic
    @ljubobratovicrelja
    Dude, you're right, there's something wrong with calling swscale from D.
    For the whole weekend I've been trying to convert rgb24 to yuv420p, and always got the same error.
    I've given up on it for now and implemented the convertion myself.
    Relja Ljubobratovic
    @ljubobratovicrelja
    But I think we should check this problem we other D people on the forums
    I'll try to write a post about it asap
    check this out..
    I'll go post this on forums ask if someone has any idea what could cause this...
    Relja Ljubobratovic
    @ljubobratovicrelja
    Duuuude... I've just been going through the D code for swscale
    and I've spotted that SwsContext is an empty struct!
    I'll try to fix this, and let you know here when I've got some results...
    Relja Ljubobratovic
    @ljubobratovicrelja
    I've fixed it. Please see the issue you've filled in the beginning.
    Again, thanks for your help!
    Aaron Yeoh Cruz
    @hyperum
    Okay, well, many thanks for yours too. Thank you and the other collaborators for maintaining this library!
    Changlang Kuang
    @kuangchanglang
    does anyone know how to use av_seek_frame
    I try all possible formats, still not working
    Changlang Kuang
    @kuangchanglang
    oops, no one here
    Jefferson de Andrade Santos
    @jersobh
    hi
    anybody there?
    claudeJShaldoupt
    @claudeJShaldoupt
    Weird question, if a decoder is sent a flush packet and resets the AVCodecContext, can you reset the context to a known point by giving it a decoded frame? What are ways you can restore AVCodecContext at a certain point, if any?
    claudeJShaldoupt
    @claudeJShaldoupt
    I have a transcoder that transcodes video to h264 and need to format the output packet into 188byte mpegts packets, how can i do so?
    Parthib Dutta
    @parthibd
    Hi all
    I am facing troubles with ffmpeg hls transcode
    here is my code
    ffmpeg -re -i video.mp4 -f hls ^
    -vf scale=w=640:h=-2 -c:a aac -ar 48000 -c:v h264 -profile:v main -crf 20 -sc_threshold 0 -g 48 -keyint_min 48 -hls_time 4 -b:v 800k -maxrate 856k -bufsize 1200k -b:a 96k -hls_segmentfilename D:\xampp\htdocs\streaming-demo\360p%%03d.ts -master_plname master.m3u8 D:\xampp\htdocs\streaming-demo\360p%v.m3u8 ^
    -vf scale=w=842:h=-2 -c:a aac -ar 48000 -c:v h264 -profile:v main -crf 20 -sc_threshold 0 -g 48 -keyint_min 48 -hls_time 4 -b:v 1400k -maxrate 1498k -bufsize 2100k -b:a 128k -hls_segmentfilename D:\xampp\htdocs\streaming-demo\480p%%03d.ts -master_plname master.m3u8 D:\xampp\htdocs\streaming-demo\480p%v.m3u8 ^
    -vf scale=w=1280:h=-2 -c:a aac -ar 48000 -c:v h264 -profile:v main -crf 20 -sc_threshold 0 -g 48 -keyint_min 48 -hls_time 4 -b:v 2800k -maxrate 2996k -bufsize 4200k -b:a 128k -hls_segmentfilename D:\xampp\htdocs\streaming-demo\720p%%03d.ts -master_plname master.m3u8 D:\xampp\htdocs\streaming-demo\720p%v.m3u8 ^
    -vf scale=w=1920:h=-2 -c:a aac -ar 48000 -c:v h264 -profile:v main -crf 20 -sc_threshold 0 -g 48 -keyint_min 48 -hls_time 4 -b:v 5000k -maxrate 5350k -bufsize 7500k -b:a 192k -hls_segmentfilename D:\xampp\htdocs\streaming-demo\1080p%%03d.ts -master_plname master.m3u8 D:\xampp\htdocs\streaming-demo\1080p%v.m3u8
    the master playlist contains olny one resolution