Re: [Libav-user] Help : Preserve meta data

2019-08-06 Thread Philippe Gorley

On 2019-08-06 5:30 a.m., Rockland wrote:

Hello all,

Can someone tells me which option I can add among my configure options 
to preserve metadata during transcoding? In command line I know that the 
option is map_metadata but I'm using libav

in my project.


The relevant code is in fftools/ffmpeg_opt.c in copy_metadata(). It uses 
av_dict_copy.


If you meant you're using the libav project (as in libav.org), you're on 
the wrong mailing list.




This is my configure options :
  CONFIGURE_COMMAND
             env LD_PRELOAD=${ALGOLIB_DIR}/libalgolib.so 
/configure

             --prefix=
             --extra-cflags=-I/include
             --extra-ldflags=-L/lib
             --extra-libs=-lalgolib\ -lpthread
             --enable-gpl
             --enable-nonfree
             --enable-libfdk-aac
             --disable-doc
             --enable-pthreads
             --disable-programs
             --enable-shared
             --enable-static
             --enable-runtime-cpudetect

Regards

___
Libav-user mailing list
Libav-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-requ...@ffmpeg.org with subject "unsubscribe".



Cheers,

--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux
___
Libav-user mailing list
Libav-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [Libav-user] Determine if input protocol is RTSP or file

2019-07-05 Thread Philippe Gorley

On 2019-07-05 2:23 a.m., lukas wrote:

Dear libavusers,

I patched some files of libavformat and libavcodec to include timestamps
from RTPDemuxContext in the AVPacket (I did it similar to [1]). This is
for the purpose of synchronizing multiple streams on the receiver side
and works fine. Of course, it only works when the stream protocol is
RTSP or RTP, not if the input is a file or another protocol that does
not use RTPDemuxContext.

Is there any value in AVFormatContext (or similar) which indicates of
what protocol an opened stream is? Or do I have to manually parse the
url to determine, if a RTSP source or a file is opened?


AVFormatContext.iformat.name should be "rtp" or "rtsp".



Also, it would be helpful if the RTP and NTP timestamps from
RTPDemuxContext would be exposed in the public API, so that no patch is
needed. I found some solutions [2] which use the internal header files,
but finally decided to just patch the public API since I could not get
it compiled with the internal headers. Would it make sense to include
this modification? Or does it brake compatibility with other protocols?


I'd suggest having a chat with the devs over on #ffmpeg-devel 
(freenode). They're better placed to give you an answer.




Kind regards,

Lukas Bommes

[1] https://github.com/bytedeco/javacpp-presets/issues/374

[2]
https://stackoverflow.com/questions/20094998/retrieving-timestamp-in-rtp-rtsp 



___
Libav-user mailing list
Libav-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-requ...@ffmpeg.org with subject "unsubscribe".


Cheers,

--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux
___
Libav-user mailing list
Libav-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [Libav-user] How to seek to a given frame?

2019-05-09 Thread Philippe Gorley

On 2019-05-08 10:27 p.m., Mark McKay wrote:
The docs in the header file say that the AVSEEK_FLAG_BACKWARD is 
ignored, and the tests I've run seem to work even when I leave it out.


AVSEEK_FLAG_BACKWARD is ignored in avformat_seek_file, not in av_seek_frame.



Mark



*Subject:* Re: [Libav-user] How to seek to a given frame?
*Date:* Wed, 8 May 2019 13:20:17 -0700
*From:* Michael Armes 
*To:* "This list is about using libavcodec, libavformat, libavutil, 
libavdevice and libavfilter." 
*Reply-To:* "This list is about using libavcodec, libavformat, 
libavutil, libavdevice and libavfilter." 
Use |AVSEEK_FLAG_BACKWARD| 
<http://ffmpeg.org/doxygen/trunk/avformat_8h.html#ac736f8f4afc930ca1cda0b43638cc678>  to 
seek to the closest /keyframe/ having a smaller pts than the one you are 
seeking. You must then iterate through reading frames until you reach 
your desired position (if you are not seeking to a keyframe).

--michael

On Wed, May 8, 2019 at 10:53 AM Mark McKay <mailto:m...@kitfox.com>> wrote:


I'm trying to create a video player with the ability to seek
whereever I want.  I'm having some trouble with av_seek_frame(),
which seems to keep returning the first keyframe after the timestamp
I'm looking for:


     int timestamp = av_rescale_q(timeMs, AV_TIME_BASE_Q,

pFormatCtx->streams[videoStream]->time_base);

     int err = av_seek_frame(pFormatCtx, videoStream, timestamp, 0);

Unfortunately, if it puts me at a position /after/ the frame where
I'm seeking, I have already passed the frame I want and can't scan
forward to find it.  I've also tried seeking with AVSEEK_FLAG_ANY,
but this it not returning frames with valid data.  I'm guessing that
you need to jump to the correct keyframe and then scan forward so
that the frame buffers are built correctly.

I'm also considering scanning the entire video when I first load it
to build  an index of packet information. AVSEEK_FLAG_BYTE looks
like it could be useful to jump directly to the packet I want -
however, I don't know where to find the byte value I would need to
pass to the seek function.

How can I scan to the frame that I want?

Cheers,
Mark

---
http://www.kitfox.com

___
Libav-user mailing list
Libav-user@ffmpeg.org <mailto:Libav-user@ffmpeg.org>
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-requ...@ffmpeg.org <mailto:libav-user-requ...@ffmpeg.org>
with subject "unsubscribe".

---
http://www.kitfox.com


___
Libav-user mailing list
Libav-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-requ...@ffmpeg.org with subject "unsubscribe".



--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux
___
Libav-user mailing list
Libav-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [Libav-user] How to choose correct decoder for hw-accelerated decoding?

2019-04-24 Thread Philippe Gorley

On 2019-04-24 7:34 a.m., Ахмед Анам via Libav-user wrote:

Hello.

I studied */hw-decode.c/* example and in this example a decoder is 
choosen based on an input video file (calling function 
/*av_find_best_stream(input_ctx, AVMEDIA_TYPE_VIDEO, -1, -1, &decoder, 
0),* /where /*decoder */is a local variable of type /*AVCodec**/). 
I try to decode H264 videostream using hw-acceleration. To find a proper 
decoder I use /*avcodec_find_decoder(codec_id) *///function. Now for 
decoding h264 stream I use /*AV_CODEC_ID_H264 */as the argument for this 
function**/*. */Is it correct? I don't see the difference in CPU and 
GPU utilization for hardware-accelerated decoding. Even for multiple 
streams.


AV_CODEC_ID_H264 is correct.

To set up a hardware decoder, you need to set 
AVCodecContext.hw_device_ctx. In hw_decode.c, that happens in the 
hw_decoder_init function with av_hwdevice_ctx_create.


FFmpeg takes care of setting up the per-frame hardware context as you 
decode.


The choice of which hardware decoder is used is up to you 
(AVHWDeviceType enum: 
https://ffmpeg.org/doxygen/trunk/hwcontext_8h.html). In the example, 
av_hwdevice_find_type_by_name is called to get the type from the first 
command line argument.



--
С уважением, Ахмед Анам.
Best regards, Akhmed Anam.

___
Libav-user mailing list
Libav-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-requ...@ffmpeg.org with subject "unsubscribe".



--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux
___
Libav-user mailing list
Libav-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [Libav-user] list all available formats of webcam

2019-04-17 Thread Philippe Gorley

On 2019-04-17 9:03 a.m., Hristo Ivanov wrote:

Hi.

The implementation of 
'avdevice_capabilities_create'(https://ffmpeg.org/doxygen/trunk/avdevice_8c_source.html#l00143) 
starts with the following lines:


1 int ret; 2 av_assert0(s && caps); 3 av_assert0(s->iformat || 
s->oformat); 4 if ((s->oformat && 
!s->oformat->create_device_capabilities) || 5 (s->iformat && 
!s->iformat->create_device_capabilities)) 6 return AVERROR(ENOSYS);


My guess is the -40(ENOSYS) error is returned in line 6. Can you check 
in your code if 'm_pFormatCtxInCam->iformat->create_device_capabilities' 
is different from null.
The next step would be to understand why is 
'm_pFormatCtxInCam->iformat->create_device_capabilities' null. With 
ffmpeg you just have to dive in the source code and try to understand it.
Compiling a debug version of the ffmpeg libs/dlls is extremely useful 
for this purpose.


It is null because, while the API exists, it is not implemented. AFAIK, 
no device implements it.


Source: I grepped the latest source for avdevice_capabilities_create and 
found nothing of interest.


The way to go is to either parse the logs or directly use the DShow/V4L2 
libraries.


You can also implement the API yourself and send the patch to the 
ffmpeg-devel mailing list. ;)




 > Maybe I did not initialize everything correctly or bad ordering of 
open input?



Please see my code:



The code seems correct, my only problem with the above code is in the 
next line:



 > int ret = avformat_open_input(&m_pFormatCtxInCam, szUrl, m_pInFrmt, 
&m_pInOptions);


Try using no(NULL) options:


int ret = avformat_open_input(&m_pFormatCtxInCam, szUrl, m_pInFrmt, NULL);

Maybe opening an input with options shuts down the querying capabilities 
of the input, I don't really know, it's just a guess.



Regards.


___
Libav-user mailing list
Libav-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-requ...@ffmpeg.org with subject "unsubscribe".



--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux
___
Libav-user mailing list
Libav-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [Libav-user] Cleaning AVFrame properly

2019-04-01 Thread Philippe Gorley

On 2019-04-01 4:48 a.m., Venkateswaran.S wrote:

Apologise for the typos.
I'm creating AVFrame object using av_frame_alloc() function and clearing 
it using av_frame_free(&frame) which internally calls av_frame_unref(), 
but it's not cleaning the memory properly. Heap size of my app grows 
exponentially in run time.


What version of the libav* libraries are you using? Have you tried 
running valgrind on your application? I've never had this issue with 
av_frame_free.




As far as I know, av_frame_free() calls av_freep() which calls av_free() 
to free the dynamic memory. Memory gets cleaned, If I use 
av_free(frame->data[0]) directly instead of av_frame_free(&frame)



___
Libav-user mailing list
Libav-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-requ...@ffmpeg.org with subject "unsubscribe".



Cheers,

--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux
___
Libav-user mailing list
Libav-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [Libav-user] blackdetect using libavfilter C API

2019-03-08 Thread Philippe Gorley

On 2019-03-08 2:47 p.m., Venkateswaran.S wrote:

Hi Philippe,

Thanks for your reply. I have got the required output by adding below 
function call in my code,
if ((tag = av_dict_get(filt_frame->metadata, "lavfi.black_duration", 
tag, AV_DICT_IGNORE_SUFFIX)))

     printf("%s=%s\n", tag->key);

and it prints below output,

[blackdetect @ 0x5566fef000c0] black_start:5.46379 black_end:7.29896 
black_duration:1.83517
[blackdetect @ 0x5566fef000c0] black_start:82.8328 black_end:84.4594 
black_duration:1.62662
[blackdetect @ 0x5566fef000c0] black_start:142.768 black_end:144.019 
black_duration:1.25125


I'm using "lavfi.black_duration" because if I use "lavfi.black_start" it 
print black_start at 0 second (false detection).


I could not find "lavfi.black_duration" anywhere in the file 
libavfilter/vf_blackdetect.c (or the source code at all), so I doubt 
it's being set.


If the key doesn't exist in the AVDictionary, av_dict_get returns NULL 
(0). You want to check until it returns an actual AVDictionaryEntry, 
then check AVDictionaryEntry.value for the time string.




Now, I tried to run the same filter through command line using below 
command,

ffmpeg -i SonOfGod.mp4 -vf "blackdetect=d=1:pix_th=0.00" -an -f null -

and it prints below output,

[blackdetect @ 0x5601cbc54c60] black_start:5.46379 black_end:7.007 
black_duration:1.54321
[blackdetect @ 0x5601cbc54c60] black_start:82.8745 black_end:84.1674 
black_duration:1.29296


above command line tool produces perfect output and exactly matches with 
actual video content timing (black start & back end).


How does both the C API and FFmpeg cmd tool give different output? is 
there anything I'm missing in C API code 
https://ffmpeg.org/doxygen/3.4/filtering__video_8c_source.html (removed 
display_frame function).


The black duration log you see is the result of the filter subtracting 
black_start from black_end in the check_black_end function.




Testing Video: https://www.youtube.com/watch?v=-Hsl5UG9O_c&t=6s


___
Libav-user mailing list
Libav-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-requ...@ffmpeg.org with subject "unsubscribe".



You want to get lavfi.black_end and lavfi.black_start, parse the time 
strings and find the difference.


--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux
___
Libav-user mailing list
Libav-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [Libav-user] blackdetect using libavfilter C API

2019-03-08 Thread Philippe Gorley

On 2019-03-08 10:05 a.m., Venkateswaran.S wrote:

Hi,

I'm using libavfilter to detect black frame in my video. I followed this 
example https://ffmpeg.org/doxygen/3.4/filtering_video_8c-example.html , 
but this example doesn't shows how to print black frame detected 
duration, instead it prints out video frames.


The blackdetect filter sets "lavfi.black_start" in your AVFrame.metadata 
to a time string using AVFrame.pts and the time base (when it detects 
the start of a black sequence). When the black frames end, it sets 
"lavfi.black_end" in AVFrame.metadata, again using pts and time base.


You'll have to check each frame's metadata (AVDictionary*) and compute 
the duration yourself.



As of now, I have replaced
constchar*filter_descr 
<https://ffmpeg.org/doxygen/3.4/filtering__video_8c.html#a84b31b94c024a45c4bcebd875a54e73d>= 
"scale=78:24,transpose=cclock"; to constchar*filter_descr 
<https://ffmpeg.org/doxygen/3.4/filtering__video_8c.html#a84b31b94c024a45c4bcebd875a54e73d>= 
"blackdetect=d=2:pix_th=0.00";

in the code.

Thanks & regards,
S.Venkateswaran


___
Libav-user mailing list
Libav-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-requ...@ffmpeg.org with subject "unsubscribe".



--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux
___
Libav-user mailing list
Libav-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [Libav-user] Converting AV_PIX_FMT_CUDA image (AVFrame) to AV_PIX_FMT_BGRA image

2019-02-22 Thread Philippe Gorley

On 2019-02-22 5:24 a.m., Ахмед Анам wrote:
I have to transform AV_PIX_FMT_CUDA image to AV_PIX_FMT_BGRA image. In 
your code you transform AV_PIX_FMT_RGB24 to AV_PIX_FMT_NV12. I tried to 
run your code. There are no errors but I can not display images because 
I need BGRA pixel format to display them. I don't understand how to get 
BGRA image from AV_PIX_FMT_CUDA image.


AV_PIX_FMT_CUDA is a hardware format, you need to transfer the frame 
data into a software frame before using it. You can see an example of 
this in doc/examples/hw_decode.c. Look for av_hwframe_transfer_data.





--
С уважением, Ахмед Анам.
Best regards, Akhmed Anam.

___
Libav-user mailing list
Libav-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-requ...@ffmpeg.org with subject "unsubscribe".



--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux
___
Libav-user mailing list
Libav-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [Libav-user] Getting resulting width and height from scale filter

2019-02-21 Thread Philippe Gorley

On 2019-02-21 8:47 a.m., Strahinja Radman wrote:

*From: *Michael Bachmann <mailto:michael.bachm...@picsystems.ch>
*Sent: *21 February 2019 13:02
*To: *libav-user@ffmpeg.org <mailto:libav-user@ffmpeg.org>
*Subject: *[Libav-user] Getting resulting width and height from scale filter

Is there a way to get the resulting width and height from a scale 
filter, so i can setup the Encoding-AVCodecContext correctly (with width 
and height)?



Here's my init filter method, which gets feeded with the filter 
description "scale=-1:'min(720,iw)'":



int FFMPEGCommands::init_filters(const char *filters_descr, int width, 
int height, int streamFrameRate) {

     char args[512];
     int ret = 0;
     const AVFilter *buffersrc = avfilter_get_by_name("buffer");
     const AVFilter *buffersink = avfilter_get_by_name("buffersink");
     AVFilterInOut *outputs = avfilter_inout_alloc();
     AVFilterInOut *inputs = avfilter_inout_alloc();
     AVRational time_base = { 1, streamFrameRate };
     //AVRational time_base = 
fmt_ctx->streams[video_stream_index]->time_base;
     enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_YUV420P, 
AV_PIX_FMT_NONE };

     filter_graph = avfilter_graph_alloc();
     if (!outputs || !inputs || !filter_graph) {
     ret = AVERROR(ENOMEM);
     goto end;
     }
     /* buffer video source: the decoded frames from the decoder will be 
inserted here. */

     snprintf(args, sizeof(args),
     "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d",
     width, height, STREAM_PIX_FMT,
     time_base.num, time_base.den,
     0, 1);
     ret = avfilter_graph_create_filter(&buffersrc_ctx, buffersrc, "in",
     args, NULL, filter_graph);
     if (ret < 0) {
     av_log(NULL, AV_LOG_ERROR, "Cannot create buffer source\n");
     goto end;
     }
     /* buffer video sink: to terminate the filter chain. */
     ret = avfilter_graph_create_filter(&buffersink_ctx, buffersink, "out",
     NULL, NULL, filter_graph);
     if (ret < 0) {
     av_log(NULL, AV_LOG_ERROR, "Cannot create buffer sink\n");
     goto end;
     }
     ret = av_opt_set_int_list(buffersink_ctx, "pix_fmts", pix_fmts,
     AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN);
     if (ret < 0) {
     av_log(NULL, AV_LOG_ERROR, "Cannot set output pixel format\n");
     goto end;
     }
     /*
  * Set the endpoints for the filter graph. The filter_graph will
  * be linked to the graph described by filters_descr.
  */
  /*
   * The buffer source output must be connected to the input pad of
   * the first filter described by filters_descr; since the first
   * filter input label is not specified, it is set to "in" by
   * default.
   */
     outputs->name = av_strdup("in");
     outputs->filter_ctx = buffersrc_ctx;
     outputs->pad_idx = 0;
     outputs->next = NULL;
     /*
  * The buffer sink input must be connected to the output pad of
  * the last filter described by filters_descr; since the last
  * filter output label is not specified, it is set to "out" by
  * default.
  */
     inputs->name = av_strdup("out");
     inputs->filter_ctx = buffersink_ctx; 
     inputs->pad_idx = 0;

     inputs->next = NULL;
     if ((ret = avfilter_graph_parse_ptr(filter_graph, filters_descr,
     &inputs, &outputs, NULL)) < 0)
     goto end;
     if ((ret = avfilter_graph_config(filter_graph, NULL)) < 0)
     goto end;
end:
     avfilter_inout_free(&inputs);
     avfilter_inout_free(&outputs);
     return ret;
}


The info you are seeking should be available here 
filter_ctx.buffersink_ctx->inputs[0]->w  for width and 
filter_ctx.buffersink_ctx->inputs[0]->h for height.


From avfilter.h: "Applications must not normally access the link 
structure directly. Use the buffersrc and buffersink API instead."


The buffersink API (described in buffersink.h) shows that 
av_buffersink_get_w and av_buffersink_get_h can be used by passing in 
buffersink_ctx.





___
Libav-user mailing list
Libav-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-requ...@ffmpeg.org with subject "unsubscribe".



--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux
___
Libav-user mailing list
Libav-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [Libav-user] Overlay filter has incorrect frame rate

2018-07-27 Thread Philippe Gorley

On 2018-07-27 11:24 AM, Brian C. Wiles wrote:



On 07/27/2018 10:10 AM, Philippe Gorley wrote:


Overlay takes frames from each input in timestamp order. It likely
overlays two frames when they have matching timestamps. So the fps and
setpts filters are necessary if the 2 inputs have different
framerates/starting points.

The ffmpeg tool likely takes care of this for you.

Cheers,


   That's what I wondered.  So, if I specify the right fps and setpts
combinations, it should work fine?  I thought the overlay filter was
supposed to add and drop frames as needed.  Also, do I specify the frame
rate of the overlaid video or the bottom one?  Thanks!


I usually use the higher fps of the two, so if in1 is 30 fps and in2 is 
15, I'd use something like:
[in1] setpts=PTS-STARTPTS [m]; [in2] setpts=PTS-STARTPTS, fps=30 [o]; 
[m] [o] overlay=... [out]




___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user



--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Overlay filter has incorrect frame rate

2018-07-27 Thread Philippe Gorley

On 2018-07-27 10:38 AM, Brian C. Wiles wrote:

Hi,


   I am trying to programmatically overlay one video onto another, and
the top (overlaid) video plays at half it's normal frame rate.  If I use
the ffmpeg command, it works fine. >

   I started with the doc/examples/transcoding.c example and changed the
filter initialization.  Here's how I create the filters:


static int init_filters(char *source, char *source_type)
{
     char filter_spec[2000];
     unsigned int i;
     int ret;
     filter_ctx = av_malloc_array(ifmt_ctx->nb_streams, sizeof(*filter_ctx));
     if (!filter_ctx)
     return AVERROR(ENOMEM);

     for (i = 0; i < ifmt_ctx->nb_streams; i++)
     {
     filter_ctx[i].buffersrc_ctx = NULL;
     filter_ctx[i].buffersink_ctx = NULL;
     filter_ctx[i].filter_graph = NULL;
     if (!(ifmt_ctx->streams[i]->codecpar->codec_type ==
   AVMEDIA_TYPE_AUDIO ||
   ifmt_ctx->streams[i]->codecpar->codec_type ==
AVMEDIA_TYPE_VIDEO))
     continue;

     if (ifmt_ctx->streams[i]->codecpar->codec_type ==
AVMEDIA_TYPE_VIDEO)
     {
     sprintf(
     filter_spec,
     "movie='anim.mp4', "
     "scale=w='min(250\\, iw*3/2):h=-1' [wm]; "
     "[in][wm]
overlay=x=main_w-overlay_w-50:y='main_h-overlay_h-50'"
     ":enable='between(t,5,10)' [out]");
     }
     else
     {
     strcpy(filter_spec,
    "anull"); /* passthrough (dummy) filter for audio */
     }

     ret = init_filter(&filter_ctx[i], stream_ctx[i].dec_ctx,
   stream_ctx[i].enc_ctx, filter_spec);
     if (ret)
     return ret;
     }
     return 0;
}

   I have tried using the fps and setpts filters, but that seems like a
hack to get it to honor the actual frame rate in the file.  Let me know
if you need more info.  I appreciate any help someone can give me.  Thanks!


Overlay takes frames from each input in timestamp order. It likely 
overlays two frames when they have matching timestamps. So the fps and 
setpts filters are necessary if the 2 inputs have different 
framerates/starting points.


The ffmpeg tool likely takes care of this for you.




-Brian


___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user



Cheers,

--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


[Libav-user] av_buffersink_get_frame_flags always returns EAGAIN

2018-05-02 Thread Philippe Gorley

Hi,

I'm implementing multi input filters in our application. Every call to 
av_buffersink_get_frame_flags returns EAGAIN, even if I push all the 
frames to my buffer sources beforehand.


I've written an example of what I'm doing here: 
https://pastebin.com/WBANDTkh


I'm generating dummy video frames, downsizing one of them and then 
overlaying it over the other.


I think the problem might be linked with the NaN value in this log: 
[Parsed_overlay_1 @ 0x2429f80] n:1.00 t:0.00 pos:nan 
x:230.00 xi:230 y:170.00 yi:170


Any help on what I'm doing wrong is greatly appreciated.

Thanks,

--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Scale filter converting to grayscale

2018-04-30 Thread Philippe Gorley

On 2018-04-30 03:44 PM, Carl Eugen Hoyos wrote:

2018-04-30 21:10 GMT+02:00, Philippe Gorley
:


It segfaults when writing the frame. I'm expecting a yuv420p frame


But you are asking the filter chain to output gray.


enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE };
if ((ret = av_opt_set_int_list(buffersink_ctx, "pix_fmts", pix_fmts,


I guess I should've looked more carefully. Thank you.




Confidentiality Message: This communication (including any files
transmitted with it) is intended solely for the person or entity to
whom it is addressed, and may contain confidential or privileged
information.


Please remove this from mails sent to a public mailing list.

Carl Eugen
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user



Cheers,

--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


[Libav-user] Scale filter converting to grayscale

2018-04-30 Thread Philippe Gorley

Hi,

I'm having trouble getting filters to work correctly. It creates dummy 
YUV frames, scales them using libavfilter, and saves the raw data to 
disk (heavily based on filtering_video.c). The end goal is to use 
libavfilter instead of implementing such things ourselves.


It segfaults when writing the frame. I'm expecting a yuv420p frame, but 
the filtered frame is in grayscale (AV_PIX_FMT_GRAY8), even though I 
specify yuv420p in the filter string (scale=w=200:h=100:dst_format=0).


Here is the code: https://pastebin.com/rNegZcng
I'm on FFmpeg master (commit cae6f806a6367c7760ab6ed059d343d4a8eebd56).

And here are the logs I'm getting:
detected 4 logical cores
[in @ 0x1e41200] Setting 'video_size' to value '320x240'
[in @ 0x1e41200] Setting 'pix_fmt' to value '0'
[in @ 0x1e41200] Setting 'time_base' to value '1/1'
[in @ 0x1e41200] Setting 'pixel_aspect' to value '1/1'
[in @ 0x1e41200] w:320 h:240 pixfmt:yuv420p tb:1/1 fr:0/1 sar:1/1 sws_param:
[Parsed_scale_0 @ 0x1e42280] Setting 'w' to value '200'
[Parsed_scale_0 @ 0x1e42280] Setting 'h' to value '100'
[Parsed_scale_0 @ 0x1e42280] Setting 'dst_format' to value '0'
[Parsed_scale_0 @ 0x1e42280] w:200 h:100 flags:'bilinear' interl:0
[AVFilterGraph @ 0x1e407c0] query_formats: 3 queried, 2 merged, 0 
already done, 0 delayed
[Parsed_scale_0 @ 0x1e42280] w:320 h:240 fmt:yuv420p sar:1/1 -> w:200 
h:100 fmt:gray sar:2/3 flags:0x2
[Parsed_scale_0 @ 0x1e42280] w:320 h:240 fmt:yuv420p sar:0/1 -> w:200 
h:100 fmt:gray sar:0/1 flags:0x2

[swscaler @ 0x1e42f80] bad dst image pointers
Frame scaled from 320x240 to 200x100
Segmentation fault

Backtrace:
#0  __mempcpy_sse2 () at ../sysdeps/x86_64/memcpy.S:196
#1  0x77364242 in _IO_new_file_xsputn (f=0x635430, data=0x0, 
n=0x64) at fileops.c:1319
#2  0x773597bb in __GI__IO_fwrite (buf=0x0, size=0x64, 
count=0x1, fp=0x635430) at iofwrite.c:39
#3  0x0040114b in save_yuv_frame (frame=0x604040, 
frame_number=0x0) at video_filter.c:52
#4  0x00401a4f in main (argc=0x1, argv=0x7fffda48) at 
video_filter.c:203


Any tips on what I'm doing wrong and why libavfilter is converting my 
frame to AV_PIX_FMT_GRAY8?


Cheers,

--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux

Confidentiality Message: This communication (including any files
transmitted with it) is intended solely for the person or entity to
whom it is addressed, and may contain confidential or privileged
information.
The disclosure, distribution or copying of this message is strictly
forbidden. Should you have received this communication in error,
kindly contact the sender promptly, destroy any copies and delete
this message from your computer system.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] New api and deprecation warning

2018-03-14 Thread Philippe Gorley

On 2018-03-14 03:26 PM, Michael IV wrote:
Hi. I am trying to get rid of deprecation warning in the API. I am 
running with
ffmpeg -20170711 version. I have a code where I don't explicitly create 
AVCodecContext
because I multiplex already existing h264 NALS. But I still have to 
setup AVStream which has AVCodecContext which it creates internally 
based on the codec I pass into


avformat_new_stream

.So I have something like this then:

mVideoOutStream->codec->gop_size = muxerParams.gopSize;
mVideoOutStream->codec->time_base.den = mVideoOutStream->time_base.den;
mVideoOutStream->codec->time_base.num = mVideoOutStream->time_base.num;

EYE_ASSERT(mVideoOutStream);

if (mOutputFormatContext->oformat->flags & AVFMT_GLOBALHEADER)
{
mVideoOutStream->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
}

Every place I access '->codec->' the compiler says it's deprecated,and 
the FFMPEG says
I have to use codecpar instead.But codecpar doesn't have those params. 


For demuxing/decoding:
avcodec_parameters_to_context(codec_ctx, stream->codecpar);

For muxing/encoding:
avcodec_parameters_from_context(stream->codecpar, codec_ctx);

Documentation for these functions can be found here: 
https://www.ffmpeg.org/doxygen/trunk/group__lavc__core.html


doc/examples/transcoding.c shows how to use both.

What do I do in this case? Create explicitly codec context and assign it 
to the stream? Looks like newer API has some design gaps > Thanks.






___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user



--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux

Confidentiality Message: This communication (including any files
transmitted with it) is intended solely for the person or entity to
whom it is addressed, and may contain confidential or privileged
information.
The disclosure, distribution or copying of this message is strictly
forbidden. Should you have received this communication in error,
kindly contact the sender promptly, destroy any copies and delete
this message from your computer system.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Video conversion issue

2018-02-28 Thread Philippe Gorley

On 2018-02-28 04:40 AM, Beere, Viswanath wrote:

*Debug console Error:*
---
transcodingFileWithPath
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 
'/Users/viswanath/Library/Developer/CoreSimulator/Devices/A71B16D3-86A9-4403-A6B1-9A8D23B842C0/data/Containers/Bundle/Application/0342E695-051C-4C71-9C54-581196CC2FE8/DLGDemo.app/VID_00222.mpg':

Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf54.0.100
Duration: 00:00:30.08, start: 0.00, bitrate: 1360 kb/s
Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), 
yuv420p, 1024x720 [SAR 1:1 DAR 64:45], 1226 kb/s, 25 fps, 25 tbr, 25 
tbn, 25 tbc (default)

Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, 
fltp, 128 kb/s (default)

Metadata:
handler_name : SoundHandler
[h264_videotoolbox @ 0x7f9354822600] Error setting max bitrate property: 
-12902


This is kVTParameterErr 
(https://developer.apple.com/documentation/videotoolbox/1490398-error_code_constants/kvtparametererr?language=objc). 
You'll have to check your VideoToolbox setup code.



Cannot open video encoder for stream #0
Error occurred: Generic error in an external library

---

Thanks and regards,
Viswanath

This message contains information that may be privileged or confidential 
and is the property of the Capgemini Group. It is intended only for the 
person to whom it is addressed. If you are not the intended recipient, 
you are not authorized to read, print, retain, copy, disseminate, 
distribute, or use this message or any part thereof. If you receive this 
message in error, please notify the sender immediately and delete all 
copies of this message.




___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user



--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux

Confidentiality Message: This communication (including any files
transmitted with it) is intended solely for the person or entity to
whom it is addressed, and may contain confidential or privileged
information.
The disclosure, distribution or copying of this message is strictly
forbidden. Should you have received this communication in error,
kindly contact the sender promptly, destroy any copies and delete
this message from your computer system.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] PRORES decoding using AVCODEC and ffmpeg 3.3.3

2017-11-06 Thread Philippe Gorley

On 2017-11-06 11:40 AM, Francesco, Cuzzocrea wrote:

Hi to all

I found that ffmpeg can decode PRORES, while it seems that avcodec doesn't.

If I issue:

ffmpeg.exe -i test_prores.mov test.mp4

it convert the mov prores file correctly, whilst using libavcodec 
doesn't.  Here is the snippet of code:


  vd_codec = avcodec_find_decoder(AV_CODEC_ID_PRORES);

  pCodecCtxFF = avcodec_alloc_context3(vd_codec);

  glob_frm = av_frame_alloc();   // allocate and init a re-usable frame

  avcodec_open2(pCodecCtxFF, vd_codec,NULL);

    av_init_packet(&thpkt);

// Read a single PRORES FRAME and put it into tempBuff
   fileSize = PutFileIntoBuffer(srcFile.c_str(),tempBuff);


   thpkt.size =  fileSize;    thpkt.data = tempBuff;

   conv_res = avcodec_send_packet(pCodecCtxFF, &thpkt);
   if(conv_res<0)
   {
  if(av_strerror(conv_res, errbuf, 512)==0)  stre.printf("Error 
sending packet : %s",errbuf);
   else  stre.printf("Error %x returned from avcodec_send_packet : 
%s",errbuf);

  goto __exit_pres;
   }


result is the message "Error sending packet : Not yet implemented in 
FFmpeg, patches welcome".


I attempt to compile with and without --enable-version3 in the configure 
but nothing changes.


Anyone experienced decoding of PRORES frame ?

Regards




Are you registering the codec? IE: are you calling av_register_all() 
before using libav* code?


--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux

Confidentiality Message: This communication (including any files
transmitted with it) is intended solely for the person or entity to
whom it is addressed, and may contain confidential or privileged
information.
The disclosure, distribution or copying of this message is strictly
forbidden. Should you have received this communication in error,
kindly contact the sender promptly, destroy any copies and delete
this message from your computer system.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] avcodec_copy_context deprecation

2017-09-28 Thread Philippe Gorley

On 2017-09-28 07:30 AM, Michael IV wrote:

Hi!
I am getting compiler warning for avcodec_parameters_copy being deprecated.


avcodec_parameters_copy is not deprecated on master.



But I also can't figure out how to use avcodec_parameters_copy when I 
have AVStream as destination and  AVCodecContext as src .AVCodecContext 
doesn't have  AVCodecParamters property.


You'll want to look at avcodec_parameters_from_context and 
avcodec_parameters_to_context, which are described here: 
https://ffmpeg.org/doxygen/trunk/group__lavc__core.html


You can find an example of their use in doc/examples/transcoding.c





___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user



Cheers,

--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux

Confidentiality Message: This communication (including any files
transmitted with it) is intended solely for the person or entity to
whom it is addressed, and may contain confidential or privileged
information.
The disclosure, distribution or copying of this message is strictly
forbidden. Should you have received this communication in error,
kindly contact the sender promptly, destroy any copies and delete
this message from your computer system.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Extracting samples from audio file

2017-08-15 Thread Philippe Gorley

On 2017-08-15 04:40 PM, Paul B Mahol wrote:

On 8/15/17, Philippe Gorley  wrote:

On 2017-08-10 01:17 PM, salsaman wrote:

Correct, you would first create the swr_context then use it to convert
the data.

___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user



I'm still struggling with getting this to work. My code is here:
https://pastebin.com/arzUw2za

The commented out code at the bottom is the old Sndfile code, which I'd
like to replace using FFmpeg. What it does is read all the audio samples
into an array of int16_t. NB: Sndfile calls them frames, while FFmpeg
calls them samples.

Right now, my code gives me low volume static.

I'm setting up the decoding pipeline, it (seems to, at least) works. I'm
getting the same number of samples as Sndfile does. I'm guessing the
problem lies with the resampling code.

I'm calling swr_config_frame and swr_convert_frame for each decoded
frame, loop through the output frame's extended_data[0] and append those
samples to an std::vector.

Notes:
AudioSample is an alias for int16_t.
AudioBuffer is a container with an std::vector>
(one for each channel).
AudioFormat is a POD struct with the sample rate and number of channels.

Can anyone look at this and tell me what I'm doing wrong?


needResamping is triggered only when same sample rate is both ways.
Are you sure that swr resample code works that way, you can not
guarantee it will
give output frame for each input frame. There are nice swr examples in
repo, Have you looked at them?


Even when commenting out the else block and forcing the resampling, I 
get the problem. But yes, that might be a future problem. Thanks for 
flagging it.


I have looked at docs/examples/resampling_audio.c (but does not use 
AVFrame), the code in libswresample, and have read the docs (at least, 
whatever I could find).


Maybe I should use swr_convert instead of swr_convert_frame and directly 
append the out samples to my vector?






Thanks,

___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user



Thanks,

--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux

Confidentiality Message: This communication (including any files
transmitted with it) is intended solely for the person or entity to
whom it is addressed, and may contain confidential or privileged
information.
The disclosure, distribution or copying of this message is strictly
forbidden. Should you have received this communication in error,
kindly contact the sender promptly, destroy any copies and delete
this message from your computer system.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Extracting samples from audio file

2017-08-15 Thread Philippe Gorley

On 2017-08-10 01:17 PM, salsaman wrote:
Correct, you would first create the swr_context then use it to convert 
the data. 


___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user



I'm still struggling with getting this to work. My code is here: 
https://pastebin.com/arzUw2za


The commented out code at the bottom is the old Sndfile code, which I'd 
like to replace using FFmpeg. What it does is read all the audio samples 
into an array of int16_t. NB: Sndfile calls them frames, while FFmpeg 
calls them samples.


Right now, my code gives me low volume static.

I'm setting up the decoding pipeline, it (seems to, at least) works. I'm 
getting the same number of samples as Sndfile does. I'm guessing the 
problem lies with the resampling code.


I'm calling swr_config_frame and swr_convert_frame for each decoded 
frame, loop through the output frame's extended_data[0] and append those 
samples to an std::vector.


Notes:
AudioSample is an alias for int16_t.
AudioBuffer is a container with an std::vector> 
(one for each channel).

AudioFormat is a POD struct with the sample rate and number of channels.

Can anyone look at this and tell me what I'm doing wrong?

Thanks,

--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux

Confidentiality Message: This communication (including any files
transmitted with it) is intended solely for the person or entity to
whom it is addressed, and may contain confidential or privileged
information.
The disclosure, distribution or copying of this message is strictly
forbidden. Should you have received this communication in error,
kindly contact the sender promptly, destroy any copies and delete
this message from your computer system.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] How to use hardware acceleration?

2017-08-15 Thread Philippe Gorley

On 2017-08-07 07:16 PM, Wagner Patriota wrote:
1. Is there a generic/multi-platform logic/flow for enabling the 
hardware acceleration for encoders/decoders using only FFmpeg API?


Nothing like a on/off switch. There's a bit of work to do to benefit 
from hardware acceleration.




2. I noticed that FFmpeg source code has separated files like 
ffmpeg_dxva2.c, ffmpeg_videotoolbox.c, etc and uses them to prepare some 
stuff before using the hardware acceleration.
Supposing I don't know anything about the underlying of the hardware 
acceleration and just want to use it without having to deal with 
platform specific code... is it possible? is there a good example for this?


Unfortunately, since every API is developed by different entities, it is 
near impossible to make them all follow the same workflow. A lot of work 
is being done here to make it as painless as possible.


As for an example, I've managed to implement vaapi, vdpau, videotoolbox 
and vda in GNU Ring (mirror here: 
https://github.com/savoirfairelinux/ring-daemon). Files of interest are 
src/media/media_decoder.cpp, src/media/video/accel.h, 
src/media/video/accel.cpp, src/media/video/v4l2/vaapi.cpp, 
src/media/video/v4l2/vdpau.cpp, and 
src/media/video/osxvideo/videotoolbox.cpp


VLC, mpv and the ffmpeg command-line tool use the hwaccel API.



3. I noticed that the special case of the VDA exposes the decoder 
"h264_vda" as an AVCodec just like any other codecs... why not do this 
for all the other hardware acceleration? like DXVA2, QuickSync, NVENC, 
etc...


Those are standalone accelerated codecs. I'm not sure why exactly this 
was replaced by the hwaccel API.


I don't think hardware encoding follows a similar API within FFmpeg. 
Most of them are standalone codecs from what I've seen.





___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user



Cheers,

--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux

Confidentiality Message: This communication (including any files
transmitted with it) is intended solely for the person or entity to
whom it is addressed, and may contain confidential or privileged
information.
The disclosure, distribution or copying of this message is strictly
forbidden. Should you have received this communication in error,
kindly contact the sender promptly, destroy any copies and delete
this message from your computer system.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Extracting samples from audio file

2017-08-10 Thread Philippe Gorley

On 2017-08-09 07:57 PM, salsaman wrote:

Hi Philippe,
I would suggest you look into libswresample, particularly swr_convert().


Didn't know about swr_convert, thanks.

The in parameter comes from a decoded frame (AVFrame->data)?


regards,
Gabriel.


http://lives-video.com
https://www.openhub.net/accounts/salsaman

___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user



Cheers,

--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux

Confidentiality Message: This communication (including any files
transmitted with it) is intended solely for the person or entity to
whom it is addressed, and may contain confidential or privileged
information.
The disclosure, distribution or copying of this message is strictly
forbidden. Should you have received this communication in error,
kindly contact the sender promptly, destroy any copies and delete
this message from your computer system.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


[Libav-user] Extracting samples from audio file

2017-08-09 Thread Philippe Gorley

Hi,

I need to read an audio file into an array of samples and then 
deinterleave/resample it. Right now, I'm decoding the file using the 
avcodec_send_packet/avcodec_receive_frame API. But how do I get the 
samples from an AVFrame into an int16_t?


Cheers,

--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux

Confidentiality Message: This communication (including any files
transmitted with it) is intended solely for the person or entity to
whom it is addressed, and may contain confidential or privileged
information.
The disclosure, distribution or copying of this message is strictly
forbidden. Should you have received this communication in error,
kindly contact the sender promptly, destroy any copies and delete
this message from your computer system.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


[Libav-user] When to call av_packet_unref

2017-04-13 Thread Philippe Gorley

Hi all,

Quick question: is a call to av_packet_unref necessary before returning 
from my decoding function, on success as well as error? This function is 
also the one that calls av_packet_init.


Thanks,

--
Philippe Gorley
Consultant en logiciel libre | Montréal, Qc
Savoir-faire Linux

Message de confidentialité : Ce courriel (de même que les
fichiers joints) est strictement réservé à l'usage de la personne
ou de l'entité à qui il est adressé et peut contenir de
l'information privilégiée et confidentielle. Toute divulgation,
distribution ou copie de ce courriel est strictement prohibée. Si
vous avez reçu ce courriel par erreur, veuillez nous en aviser
sur-le-champ, détruire toutes les copies et le supprimer de votre
système informatique.

___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


[Libav-user] Two streams from same webcam

2017-03-30 Thread Philippe Gorley

Hi,

I'm optimizing a video calling application. Currently, it grabs video 
from a webcam, decodes it, displays a preview (by resizing) of the video 
on the client, encodes the stream and sends it over RTP. I've seen 
webcams that can serve pre-encoded streams (such as H.264) directly.


Is it possible to send the high resolution pre-encoded stream directly, 
while displaying a low resolution preview? Trying to use the webcam in 
two different applications results in one of them not working as the 
resource is busy, but can the same application get two different 
streams, as in different resolutions and codecs, from the same webcam?


Thanks,

--
Philippe Gorley
Consultant en logiciel libre | Montréal, Qc
Savoir-faire Linux

Message de confidentialité : Ce courriel (de même que les
fichiers joints) est strictement réservé à l'usage de la personne
ou de l'entité à qui il est adressé et peut contenir de
l'information privilégiée et confidentielle. Toute divulgation,
distribution ou copie de ce courriel est strictement prohibée. Si
vous avez reçu ce courriel par erreur, veuillez nous en aviser
sur-le-champ, détruire toutes les copies et le supprimer de votre
système informatique.

___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] avformat_find_stream_info times out on rtp stream

2016-09-19 Thread Philippe Gorley
Hello again,

I was away for a few days, sorry for the delay in answering. Here is the output 
of ffmpeg: http://pastebin.com/xk3Tp70Q

Philippe
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] avformat_find_stream_info times out on rtp stream

2016-09-16 Thread Philippe Gorley
>2016-09-16 20:08 GMT+02:00 Philippe Gorley:
>>> > I've compiled FFmpeg with the following configuration:
>>> > ./configure --prefix=/usr/local --disable-everything
>>> > --disable-programs --enable-protocols
>>> > --enable-demuxers --enable-parser=h264
>>> > --enable-decoder=h264 --enable-indev=v4l2
>>> > --enable-shared
>>> >
>>> > Is this timeout a known bug?
>>>
>>> Is the issue reproducible with current FFmpeg git head?
>>> I believe a similar issue was fixed recently.
>>
>> Yes, I have reproduced with git head (as of 30 or 45 minutes ago).
>>
>>> Is it also reproducible with "./ffmpeg -i rtp://hostname:port"?
>>> Is it also reproducible if you build with "./configure && make"?
>>
>> It does not time out.
>
>Is this the answer to both questions or one of them?

The second, as my configure line does not build ffmpeg, ffprobe et al.

>> Any ideas why that is?
>
>Apparently your configure line disables a needed part
>but this may be a misunderstanding, see above.

Any ideas on where to first look for the options I need?

>Carl Eugen

Thanks for your help thus far,

Philippe
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] avformat_find_stream_info times out on rtp stream

2016-09-16 Thread Philippe Gorley
> 2016-09-16 18:16 GMT+02:00 Philippe Gorley
> :
> > I'm looking to upgrade my application (I'm currently using FFmpeg from the 
> > Ubuntu 16.04 repo)
> > to a more recent release of FFmpeg, such as 3.1.3. Everything went well, 
> > except that
> > avformat_find_stream_info now times out on my RTP stream, although it does 
> > eventually
> > return the info. I've tried linking against master with the same result. 
> > Doing some
> > investigation, I found that release 2.8.6 does not exhibit this behaviour, 
> > while 2.8.7 does.
> 
> (Which change introduced the issue but see below first?)
> 
> [...]
> 
> > I've compiled FFmpeg with the following configuration:
> > ./configure --prefix=/usr/local --disable-everything --disable-programs 
> > --enable-protocols
> > --enable-demuxers --enable-parser=h264 --enable-decoder=h264 
> > --enable-indev=v4l2
> > --enable-shared
> >
> > Is this timeout a known bug?
> 
> Is the issue reproducible with current FFmpeg git head?
> I believe a similar issue was fixed recently.

Yes, I have reproduced with git head (as of 30 or 45 minutes ago).

> Is it also reproducible with "./ffmpeg -i rtp://hostname:port"?
> Is it also reproducible if you build with "./configure && make"?

It does not time out. Any ideas why that is? Is it maybe an option in the 
AVDictionary?

As for which change introduced it, I don't know; I downloaded and compiled the 
release tarballs from http://ffmpeg.org/releases/

> Carl Eugen
> ___
> Libav-user mailing list
> Libav-user@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user

Philippe
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


[Libav-user] avformat_find_stream_info times out on rtp stream

2016-09-16 Thread Philippe Gorley
Hi,

I'm looking to upgrade my application (I'm currently using FFmpeg from the 
Ubuntu 16.04 repo) to a more recent release of FFmpeg, such as 3.1.3. 
Everything went well, except that avformat_find_stream_info now times out on my 
RTP stream, although it does eventually return the info. I've tried linking 
against master with the same result. Doing some investigation, I found that 
release 2.8.6 does not exhibit this behaviour, while 2.8.7 does.

I can reproduce the behaviour with the following snippet, with vlc taking care 
of the RTP stream (I use a mp4 file with h264 and aac codecs):

#include 
#include 

#include 
#include 
#include 

int main(int argc, char **argv) {
AVFormatContext *fmt_ctx = NULL;
char *file_to_stream = NULL;
char *stream_addr = NULL;
int ret;

if (argc != 2) {
fprintf(stderr, "usage: %s rtp://hostname:port\n",
argv[0]);
return 1;
}

stream_addr = argv[1];

av_register_all();
avformat_network_init();

fmt_ctx = avformat_alloc_context();
if (!fmt_ctx) {
ret = AVERROR(ENOMEM);
goto end;
}

ret = avformat_open_input(&fmt_ctx, stream_addr, NULL, NULL);
if (ret < 0) {
fprintf(stderr, "Could not open input\n");
goto end;
}

fmt_ctx->max_analyze_duration = 30 * AV_TIME_BASE;
printf("Finding stream info\n");

struct timeval start, end;
double elapsed_time;
gettimeofday(&start, NULL);

ret = avformat_find_stream_info(fmt_ctx, NULL);
if (ret < 0) {
fprintf(stderr, "Could not find stream information\n");
goto end;
}

gettimeofday(&end, NULL);
elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;

av_dump_format(fmt_ctx, 0, stream_addr, 0);

printf("Found stream info in %f ms\n", elapsed_time);

end:
avformat_close_input(&fmt_ctx);
avformat_network_deinit();
if (ret < 0) {
fprintf(stderr, "Error occurred: %s\n", av_err2str(ret));
return 1;
}

return 0;
}

I've compiled FFmpeg with the following configuration: ./configure 
--prefix=/usr/local --disable-everything --disable-programs --enable-protocols 
--enable-demuxers --enable-parser=h264 --enable-decoder=h264 
--enable-indev=v4l2 --enable-shared

Is this timeout a known bug?

Any help is appreciated,

Philippe
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


[Libav-user] Hardware acceleration for encoding/decoding

2016-05-04 Thread Philippe Gorley
Hi,

I'm looking to add hardware acceleration to Ring (ring.cx). It uses several 
codecs for audio (opus, speex, pcm_alaw, pcm_mulaw, g.722) and video (h.264, 
vp8, mpeg4, h.263). Ring supports Windows, Mac OSX, Android and GNU/Linux.

From what I've read online (mainly the archives and 
https://trac.ffmpeg.org/wiki/HWAccelIntro#Platformsoverview), I have to do this 
once for each GPU manufacturer, for each platform, and for each codec. Is there 
an easier way?

Thanks!
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user