Re: Given jpeg files in memory, how to transform them to mjpeg or, mp4 file?

Антон Шаров sharov_am at mail.ru
Tue Aug 29 08:16:26 UTC 2023


Thank you so much, Marianna !
 
Kind people already advised on following pipe(s):
 
(avi case) appsrc name=_appsrc  ! image/jpeg,framerate=16/1,width=768,height=576 ! avimux  ! filesink location=file.avi
 
or
 
(mp4 case) 
  appsrc name=_appsrc  ! image/jpeg, framerate=16/1, width=768,height=576 ! jpegdec ! x264enc ! mp4mux  ! filesink location=file.mp4
 
 private static void Appsrc_NeedData(object o, NeedDataArgs args)
        {
            var appsrc = (AppSrc) o;
            if (FileCounter < 70)
            {
                var file = Files[FileCounter];
                var bytes = File.ReadAllBytes(file);
                appsrc.PushBuffer(new Buffer(bytes));
                FileCounter++;
            }
            else
            {
                appsrc.EndOfStream();
            }
           
        }
> I don't really know much about MP4 so I cannot help there.
But I don't expect you can get around decoding the JPEG and encoding to H264.
 
Look at second pipe — « jpegdec ! x264enc» are keys to this.
  
>Вторник, 29 августа 2023, 10:42 +03:00 от Marianna Smidth Buschle <msb at qtec.com>:
> 
>Hi,
> 
>I expect you should be able to create a MJPEG from JPEG buffers in memory if you write an application with an appsrc in order to feed your buffers in.
> 
>Simply for MJPEGs you should be able to do something like this:
>videtestsrc ! <SRC_CAPS> ! queue ! videoconvert ! jpegenc ! avimux ! filesink location=<LOCATION>
> 
>Once you have that working you can change into feeding your own frames in with an appsrc:
>appsrc ! <SRC_CAPS> ! queue ! avimux ! filesink location=<LOCATION>
> 
>Look into the appsrc tutorials for how to feed data into it.
> 
>I don't really know much about MP4 so I cannot help there.
>But I don't expect you can get around decoding the JPEG and encoding to H264.
> 
>Best Regards
>Marianna
>On 28/08/2023 10.40,  gstreamer-devel-request at lists.freedesktop.org wrote:
>>Hi.
>>?
>>I have jpeg files in memory (byte[] in terms of C#), how to transform them into mjpeg file?
>>Can you help me with pipeline for that? Can it be done in memory, without dumping jpeg files? to disk?
>>?
>>Same problem, but now I need mp4 file.?At least I can see way to transcode mjpeg into mp4, but maybe it
>>?could be done in a more straight way ??from jpegs to mp4?
>>?
>>Thanks in advance.
>-- 
>Best regards / Med venlig hilsen
>“Marianna Smidth Buschle”
 
 
--
С Уважением,
Шаров Антон

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20230829/1b7a03ef/attachment.htm>


More information about the gstreamer-devel mailing list