[Libav-user] output-example.c replacement?

Gustav González xtingray at gmail.com
Sun May 3 01:34:49 EEST 2020


Based on the encode_video.c example, I started to work on a new version of
the "classic" output-example.c using no deprecated functions.
Here is the source code:
https://github.com/xtingray/ffmpeg/blob/master/output-example.c

This is the compilation line I am using:
  gcc output-example.c -o test -L/usr/local/ffmpeg/lib -lavformat -lavcodec
-lavutil

Now, when I try to execute it, I use these lines:
  export LD_LIBRARY_PATH=/usr/local/ffmpeg/lib:$LD_LIBRARY_PATH
  ./test test.mp4 libxh264

Getting this output:
  create_video_file() - Tracing...
  create_video_file() - codec id -> 27
  add_video_stream() - Tracing...
  Output #0, mp4, to 'test.mp4':
      Stream #0:0: Unknown: none (libx264)
  open_video_stream() - Tracing...
  [libx264 @ 0x55890aeebc00] [IMGUTILS @ 0x7ffd3de293c0] *Picture size 0x0
is invalid*
  [libx264 @ 0x55890aeebc00] Ignoring invalid width/height values
  [libx264 @ 0x55890aeebc00] [IMGUTILS @ 0x7ffd3de293a0] *Picture size 0x0
is invalid*
  [libx264 @ 0x55890aeebc00] Codec type or id mismatches
  open_video_stream() - *Could not open input codec (error 'Invalid
argument').*
  create_video_file() - *Could not initialize video codec.*

I have been trying to find out if the problem is about some environment
setting that I am missing, or if it is related to the source code directly.
So, I appreciate it if someone helps me to fix the example to make it
usable. In fact, I would love to make it part of the FFmpeg examples
package as I am aware it will be useful for beginners.

Any hint is very welcome.



On Sun, Apr 26, 2020 at 10:54 PM Gustav González <xtingray at gmail.com> wrote:

> That's exactly the point where I started my research. There is interesting
> stuff there, but as I mentioned in the first message, all the examples
> start assuming an input file.
> For example, I want to learn how to set the key parameters of an
> AVCodecParameters variable manually, so I can copy it into an
> AvContextCodec variable.
> The "from scratch" approach is the missing point in the current examples.
>
> PS: The encode_video.c has the potential to introduce several concepts,
> but it doesn't use any AVStream component, so it's still incomplete from
> the "educational" approach.
>
>
> On Sun, Apr 26, 2020 at 10:01 PM Leandro Moreira <
> leandro.ribeiro.moreira at gmail.com> wrote:
>
>> I think this is useful
>> https://github.com/FFmpeg/FFmpeg/tree/master/doc/examples
>>
>> On Sun, Apr 26, 2020, 11:49 PM Gustav González <xtingray at gmail.com>
>> wrote:
>>
>>> Hello,
>>> In the old versions of the ffmpeg source code, there was a nice example
>>> showing how to create a video file from scratch, setting the most important
>>> variables of its components.
>>> This is it:
>>> https://github.com/rvs/ffmpeg/blob/master/libavformat/output-example.c
>>>
>>> I just wonder if there is an updated version of it or some other
>>> reference I can use to create a video file using the same logic but calling
>>> the latest API methods, as much of them in the old example are already
>>> deprecated.
>>>
>>> I have seen some comments in the documentation suggesting things like:
>>> "instead use this...", but the truth is the information is really vague. A
>>> working example as the one I referenced would be a great pedagogic tool.
>>>
>>> Most of the "recent" examples take the parameters from an incoming
>>> (pre-existing) input file to run some kind of "operation" into an output
>>> file, but what if I want to create a video file from scratch? (i.e. from an
>>> image sequence)
>>>
>>> Any advice/hint would be really appreciated. Thanks.
>>>
>>> --
>>>   Gustav Gonzalez
>>>   xtingray at gmail.com
>>>
>>> _______________________________________________
>>> Libav-user mailing list
>>> Libav-user at ffmpeg.org
>>> https://ffmpeg.org/mailman/listinfo/libav-user
>>>
>>> To unsubscribe, visit link above, or email
>>> libav-user-request at ffmpeg.org with subject "unsubscribe".
>>
>> _______________________________________________
>> Libav-user mailing list
>> Libav-user at ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/libav-user
>>
>> To unsubscribe, visit link above, or email
>> libav-user-request at ffmpeg.org with subject "unsubscribe".
>
>
>
> --
> --
>   Gustav Gonzalez
>   xtingray at gmail.com
>
>

-- 
--
  Gustav Gonzalez
  xtingray at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20200502/b23f411e/attachment.html>


More information about the Libav-user mailing list