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

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Gustavo González-4
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:

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
  [hidden email]


_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: output-example.c replacement?

Leandro Moreira

On Sun, Apr 26, 2020, 11:49 PM Gustav González <[hidden email]> 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:

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
  [hidden email]

_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: output-example.c replacement?

Gustavo González-4
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 <[hidden email]> wrote:

On Sun, Apr 26, 2020, 11:49 PM Gustav González <[hidden email]> 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:

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
  [hidden email]

_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".


--
--
  Gustav Gonzalez
  [hidden email]


_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: output-example.c replacement?

Gustavo González-4
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:

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 <[hidden email]> 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 <[hidden email]> wrote:

On Sun, Apr 26, 2020, 11:49 PM Gustav González <[hidden email]> 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:

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
  [hidden email]

_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".


--
--
  Gustav Gonzalez
  [hidden email]



--
--
  Gustav Gonzalez
  [hidden email]


_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".