Re: [FFmpeg-user] transcode/convert /copy

2019-03-03 Thread James Girotti
I have had success mapping the stream again:

ffmpeg -i input.mkv -c:a:0 libmp3lame -map 0:a:0 -c:a copy output.mkv

Hope that helps,
-J
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

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

Re: [FFmpeg-user] FFmpeg Not Transcoding In Real Time

2018-12-03 Thread James Girotti
On Sun, Dec 2, 2018 at 9:59 AM Gabriel Balaich 
wrote:

> >
> > Furthermore when I try recording both streams in one 4K60 video via OBS
> > things work perfectly fine, as in real-time. So I don't understand how
> > transcoding two 1080p60 streams in FFmpeg would be anymore intensive than
> > one 4K60 stream in OBS... When looking at the GPUs encoding chip usage it
> > shows about 30% for the two 1080p60 streams on FFmpeg and 80% usage for
> > single 4K60 stream in OBS, yet the OBS recording is real-time while the
> > FFmpeg recording is at .6x speed.
>

This makes me think it's something with your commandline. I presume OBS
does not call the ffmpeg binary, but rather uses the APIs. So it might not
be possible to tell exactly what settings it uses.

>
> > Lastly I run a very similar command at home but instead of two 1080p60
> > streams I'm doing 2 4K60 streams, a 1080p60 stream, and another 2 audio
> > streams without issue. I do have a GTX 1080 though... however when
> > monitoring usage for the 1050 TI being used in this situation nothing
> > points to a GPU bottlecap.
> >
>

Theoretically, the 1050Ti should be able to encode streams up to 8K (that's
what I've gathered from Nvidia's docs).


> Update: we swapped the 1050ti for a GTX 1080 to no avail. It seems fairly
> obvious at this point that it is the CPU causing problems. However this
> still makes little sense, as stated I use a 6800K and do much more that
> what I'm trying to do on this build. The 8600K should have higher single
> core performance... However, the 6800K has Hyper Threading wile the 8600K
> does not, is it possible that FFmpeg better utilizes a Hyper Threaded
> processor?
>
> It looks to be only hitting 1-2 threads, anyway to force it to use more?
> -threads doesn't seem to do anything regardless of where I insert it into
> the command.
>

The GPU encoder is "single-thread", so it is the bottleneck as far as
multi-threading.


> Lastly would it be possible to utilize hardware accelerated decode via GPU
> to alleviate the issue? When I try to instert -hwaccel cuvid -v:c
> h264_cuvid before the inputs like tutorials would suggest the recording
> immediately errors out saying "Cannot set format options for [capture
> card]". And when I remove -v:c h264_cuvid and just use -hwaccel cuvid I get
> and endless string of errors stating "yuvj422p is incompatible", I'm
> assuming that is the capture cards native pixel format. When I try to set
> the capture cards pixel format to NV12 it errors out again with "Cannot set
> format options for [capture card]", not sure what other pixel formats GPU
> acceleration supports but I assume I'm just out of luck with this capture
> cards limited pixel format options.
>

No, your input is MJPEG. You cannot use "-hwaccel cuvid -c:v h264_cuvid".
That would be if your input was h264. There is no hw decoder for MJPEG.
That's probably okay though and may be better (I don't want to get into
that part). It's highly likely that your CPU should be able to decode fast
enough.


> Once again any insight would be much appreciated.
>

It's hard for me to understand your complete commandline, there are a lot
of options. It seems to me that some of your options are not optimum, but
they may be the settings that you want/need, which is fine that's up to you
to decide (I don't quite understand why you'd want to output in NV12, but
that's your business). I suggest that you drastically simplify your
commandline. It will be easier to troubleshoot. You might also try saving
the input directly to a file without any transcoding. Then use that file to
test with at first to see how many FPS you can get. Something like:

ffmpeg -i "whatever_your_input_is" -map 0 -c copy -t 60 input1.ts

ffmpeg -i input1.ts -c:v h264_nvenc output1.ts

If that performs well, then try two inputs. If that performs well, then try
the "live" input, etc.

Best of Luck,
-J
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

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

Re: [FFmpeg-user] Nvenc Fails with Cannot Init CUDA

2018-05-31 Thread James Girotti
>
> Using the strace utility I can get a little more information on the error:
>
> strace ffmpeg -i input.mp4 -c:v h264_nvenc output.mkv
>
> stat("/dev/nvidia-uvm", {st_mode=S_IFCHR|0666, st_rdev=makedev(249, 0),
> ...}) = 0
> stat("/dev/nvidia-uvm-tools", {st_mode=S_IFCHR|0666, st_rdev=makedev(249,
> 1), ...}) = 0
> openat(AT_FDCWD, "/dev/nvidia-uvm", O_RDWR|O_CLOEXEC) = -1 EIO
> (Input/output error)
> openat(AT_FDCWD, "/dev/nvidia-uvm", O_RDWR) = -1 EIO (Input/output error)
> ioctl(-5, _IOC(0, 0x00, 0x01, 0x3000), 0x7ffd8ccc67e0) = -1 EBADF (Bad file
> descriptor)
> ioctl(-5, _IOC(0, 0x00, 0x02, 0x3000), 0) = -1 EBADF (Bad file descriptor)
> close(-5)   = -1 EBADF (Bad file descriptor)
> write(2, "\33[48;5;0m\33[38;5;51m[h264_nvenc @"..., 47[h264_nvenc @
> 0xf33d00] ) = 47
> write(2, "\33[48;5;0m\33[38;5;196mCannot init "..., 41Cannot init CUDA
> ) = 41
>
> What is the problem here?  How can I debug this further?


From the strace it looks like there is a problem opening /dev/nvidia-uvm.
Do you have all the nvidia kernel modules loaded? Specifically nvidia-uvm?
Is there a device node /dev/nvidia-uvm?
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

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

Re: [FFmpeg-user] hwaccel cuvid with filters

2018-04-19 Thread James Girotti
>
> Maybe someone can explain how to use in filters?


This seems to be a gap in documentation, because it comes up every now and
then on the mailing list. I'll try to be brief. When using "-hwaccel cuvid"
the hw-decoded frames stay in GPU memory and are passed onto the
hw-encoder. The filters that you are trying to use are software filters.
They require decoded frames to be in CPU memory (and a format that is
compatible). To remedy this, you have two choices:

remove "-hwaccel cuvid" from your commandline (removing it causes decoded
frames to be copied from GPU->CPU memory and then CPU->GPU for encoding) OR

add 'hwdownload,format=nv12' to the beginning of filter.txt and
'hwupload_cuda' to the end.

The first option definitely reduces performance. I have not specifically
benchmarked the second, but it likely has the similar performance. The
filters you are applying will likely cause more reduction than either
though so it's moot.

Hope that helps.

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

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

Re: [FFmpeg-user] NVDEC/NVENC resources underutilization

2018-02-28 Thread James Girotti
>
> I see 30% NVENC performance loss when the transcoding path is NVDEC - RAM
> - NVENC. Does it mean system memory bandwidth is a bottleneck in this case?
> Am I faced other unavoidable overheads?
>

You will definitely see a performance loss when not using '-hwaccel cuvid',
but I have recently experienced a similar decrease in NVEnc encoding
speeds. The change happened a couple months ago after I was updating my
system. I haven't fully investigated, but I believe it was either a change
in ffmpeg or the linux kernel. What I believe is happening is that ffmpeg
is single-threading (as it must to reliable transcode), but the thread
migrates between CPU cores. On my system this leads to much lower CPU clock
speeds, because the up_threshold is never met long enough on a single core.
And thus transcoding speed is significantly impacted.

What I have done to remediate this is to use "taskset" to ensure ffmpeg
runs on a single CPU core. I don't have any specific numbers to back this
up, but I have been satisfied enough with the results to continue using it.
I tried setting two or more CPU cores, but generally only set one CPU core.
An example might look like this:

taskset -c 0 ffmpeg -hwaccel cuvid -c:v mpeg4_cuvid -i foo.avi -map 0:v:0
-c:v h264_nvenc bar.mkv

Or two cores:

taskset -c 0,1 ffmpeg -hwaccel cuvid -c:v mpeg4_cuvid -i foo.avi -map 0:v:0
-c:v h264_nvenc bar.mkv

You can test to see what gives you the best results. Another note, it is
not sufficient to use '-threads 1' instead of 'taskset' to alleviate this
slow-down as that single thread still migrates between cores.
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

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

Re: [FFmpeg-user] Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scaler_0'

2018-02-13 Thread James Girotti
>
> Recently, I faced transcoding issues with fully hardware nvdec/nvenc
> scheme. Particularly, my FFmpeg feed fails with the following error after
> 30-60 minutes of live transcoding:
>

I have recently encountered this as well, but with DVD video material.


> As I understand, some parameters change after 30-60 minutes in video
> stream and FFmpeg tries to use software scaler in fully hardware scheme.
> But I can't figure out exact reasons to act against the problem. I will be
> very grateful if someone could direct me. I use following cmd line:
>
> ---
> /usr/local/ffmpeg/bin/ffmpeg -analyzeduration 100M -probesize 100M
> -loglevel debug -hwaccel_device 1 -hwaccel cuvid -c:v h264_cuvid -deint 2
> -drop_second_field 1 -i udp://224.4.4.13:1013?fifo_siz
> e=25_nonfatal=1 -map p:1011:0 -map p:1011:1 -c:v h264_nvenc
> -profile:v high -level 4.1 -b:v 2048k -c:a libfdk_aac -b:a 128k -af
> aresample=async=1000 -f mpegts http://192.168.0.10/15/mpegts


The solution I used was to drop the all the "hwaccel" parameters, still
using hw-decoding and encoding. This does impact performance, but it
ensures that if the stream contains material of a different pixel format
that the sws can correct it and transcoding will continue.

I'm not sure if this is a regression in ffmpeg/nvidia or just bad video
material. I hadn't ever run into this until about a month ago. And it's
happened on several videos from different DVD's. I didn't dig into it, I
just dropped the hwaccel parameters and moved on with my life. I wonder if
it's actually a problem in the hw-decoder, but I didn't see any error
messages to prove that.
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

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

Re: [FFmpeg-user] 4K 60Hz Directshow Video Capture

2018-02-13 Thread James Girotti
On Tue, Feb 13, 2018 at 6:57 AM, Alex P  wrote:

> I think I've figured it out. When I use nv12 or yuv420p as the input and
> output pixel format, I get x1 performance. If I use bgr24/rgb24 as the
> input and yuv444p as the output, I get around x0.3.
>

Looks like switching pixel formats highly impacts performance. It would be
better for your capture card to output, for example, yuv444p. I can't tell
from the specs if it can do that though.

Careful selecting nv12 as format for output, my quick test showed that the
final output was yuv420p.


> In your testing James, what was the pixel format?


I was testing yuv420p samples as that is what was available to me at the
time. I have made a yuv444p using testsrc. My poor Thuban cannot decode
this FFv1 at realtime and raw-video filesize is gigantic. So I made a
lossless hevc yuv444p. Surprisingly (or maybe not) hevc_cuvid can't decode
it! Again, my poor Thuban cannot decode real-time, but there's some hope:

FFmpeg encoding speed was about 35-40 fps and hw-encoder utilization topped
out at 40%. So there's still a lot of headroom in the hw-encoder. Rough
theoretical calculation: I could get 100fps hw-encoding which is ~1.7X

I got about the same speed for h264_nvenc lossless. I got similar results
using a 3 second raw yuv444p video input file.

If there are other pix_fmts you would like me to test, let me know. I'll do
my best to try.
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

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

Re: [FFmpeg-user] 4K 60Hz Directshow Video Capture

2018-02-12 Thread James Girotti
>
> ffmpeg -f dshow -video_size 3840x2160 -framerate 6/1001 -rtbufsize
> 21 -pixel_format bgr24 -i video="MZ0380 PCI, Analog 01 Capture"
> -c:v h264_nvenc -preset lossless -f null -
> Gives me the same error
>

That's surprising, I can get about 200fps using file-based/ramdisk "-c:v
h264_nvenc -preset -lossless". Have you also tried "-c:v hevc_nvenc -preset
lossless"? What's the encoding FPS that you're getting? You technically
shouldn't be able get much more than 60fps as that's what your capture card
is supplying. Can you monitor the "Video Engine Utilization" during
encoding? In linux it's listed in the nvidia-settings GUI or "nvidia-smi
dmon" on the CLI will show enc/dec%.


> ffmpeg -f dshow -video_size 3840x2160 -framerate 6/1001 -rtbufsize
> 21 -pixel_format bgr24 -i video="MZ0380 PCI, Analog 01 Capture"
> -c:v rawvideo -f null -
> Gets me nearly x1 performance when executing from a ram disk but
>
> ffmpeg -f dshow -video_size 3840x2160 -framerate 6/1001 -rtbufsize
> 21 -pixel_format bgr24 -i video="MZ0380 PCI, Analog 01 Capture"
> -c:v rawvideo raw.nut
> Only gets me x0.5 and the buffer overflows.


> Is there a way of accelerating rawvideo decoding? Would using my
> colleagues 1080 make a difference? Thanks.


I think raw-video is already decoded. So no way/need to accelerate that.
You might try a different pix_fmt from your capture card while using
hw-encoding, but you'd have to test. I don't know the internals, i.e. when
the pixel format is converted during hw-encoding. So it might make a
difference.

Changing pixel formats might be a concern if you are trying to achieve
"100% lossless" capture. I've read that yuv444p should be sufficient
colorspace for bgr24.

There isn't a lot of info out there on encoding speed differences based on
GPU models. It's a complex subject, but from what I have observed the ASIC
is tied to the GPU clock (I have observed that GPU clock speed increases as
ASIC load increases). If that's true, then a GTX 1080, with it's higher max
clock, could have faster encoding, but I have no data to back that up only.
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

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

Re: [FFmpeg-user] 4K 60Hz Directshow Video Capture

2018-02-12 Thread James Girotti
Hi Alex,

I looked at your attached log. It appears to me that using libx265, your
computer cannot encode fast enough. It appears your computer is encoding
about 10.5 fps, but your input is about 60fps. So a lot of frames get
buffered every second while they're waiting to be encoded. This leads to
the full rtbuffer and then dropped frames. You could try increasing your
rtbufsize, but using libx265 your computer will not be able to keep up and
eventually the buffer will fill and frames will be dropped.


> Any help would be appreciated. 1080p capture right to rawvideo is perfect.
> I
> would like to use NVENC in lossless mode if anyone has experience with
> that.
>

If you look at the fps that you can do at 1080p, it will be much higher and
that's why you don't get buffer over-runs.

I also have a GTX 1050 Ti that I use for encoding. It will do hevc lossless
at about 150fps, input size 3840x2160@60hz (all in RAM):

ffmpeg -hwaccel cuvid -c:v hevc_cuvid -i /dev/shm/foo.4k60.hevc.mkv -c:v
hevc_cuvid -preset lossless /dev/shm/test.mkv

Based on my limited test, your GPU should be able to keep up and not drop
frames, YMMV. I'm not sure what impact you will have because your input is
raw-video (positive or negative). You shouldn't include "-hwaccel cuvid" on
your cli, because you won't be doing hw-decoding/transcoding.

HTH,
-J
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

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

Re: [FFmpeg-user] Impossible to convert between the formats - but why?

2018-01-22 Thread James Girotti
>
> Is there a way I could get more insights on what particularly trigger this
> message?
>

You could increase your loglevel, that will give you some hints as to
what's happening. Try "-loglevel 48", which is debug level so there will be
a lot of output.

You don't really need to do that though. I can tell you what's wrong. Using
"-hwaccel cuvid" is only necessary when doing full hardware transcoding as
it causes your frames to be in GPU memory only. With partial hardware
transcoding, you would have to use the filter "hwdownload" to get them from
then from GPU->CPU memory. It's more complex than that, but that's where
I'll leave it. TLDR: for this case not using "-hwaccel cuvid" is sufficient
and likely easier.

You have two options:

remove "-hwaccel cuvid" from your commandline or

add '-vf hwdownload,format=nv12,format=yuvj420p" (You could choose a
different final format if you like, but you have to use nv12 first.)

So it would be something like:

1. ffmpeg -c:v h264_cuvid -i foo -c:v mjpeg bar.mjpeg

2. ffmpeg -hwaccel cuvid -c:v h264_cuvid -i foo -c:v mjpeg -vf
"hwdownload,format=nv12,format=yuvj420p" bar.mjpeg

Hope that helps.
-James
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

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

Re: [FFmpeg-user] The option of -hwaccel device doesn't works well(FFmpeg n3.4)

2017-11-06 Thread James Girotti
On Sun, Nov 5, 2017 at 6:16 PM, Baek Seung Hoon 
wrote:

> (Its mail continuous previous my one.. sorry)
> ​
> I wonder know what is different ffmpeg internal sequence following 2
> commands..
>
> 1.
>  > ffmpeg -y -i ./input.mp4 -filter_complex
> "[0:v]hwupload_cuda=device=0,scale_npp=w=960:h=540[map0]" -map "[map0]"
> -c:v h264_nvenc -c:a copy ./output.mp4
>
> 2.
>  > ffmpeg -y -hwaccel cuvid -i ./input.mp4 -filter_complex
> "[0:v]hwupload_cuda=device=0,scale_npp=w=960:h=540[map0]" -map "[map0]"
> -c:v h264_nvenc -c:a copy ./output.mp4
>
> In fact, the performance is similar as 861 fps for encoding.
> Could I ask you what role "hwaccel cuvid" is in the above command?
>

TLDR: No affect. Maybe a tiny bit of overhead at start.

The answer is probably long and I'll probably be (a little) wrong. From the
wiki page cited earlier; -hwaccel cuvid will attempt to use hw-decoding and
fall-back to sw-decoding if not possible automatically. Without options
'-hwaccel' tries internal hw-decoders before falling-back, because the
cuvid decoders are external you have to specify "cuvid" option and to use
the decoder: -c:v h264_cuvid. Or ffmpeg will fall-back to sw-decoding. So
only specifying '-hwaccel cuvid' without a decoder should fall-back to
sw-decoding automatically.

The whole hwaccel thing is more complex than that because if you use
hw-decoder and hw-encoder, but do not specify '-hwaccel cuvid', then your
frames get passed through system memory. So there must be more happening
with '-hwaccel cuvid' than just setting up a decoder. I tried looking at
the code, but I'm a little lost on this one.


>
> Thanks again :)
>

I'm glad I was able to help. As always, I gained knowledge from helping
you. So, thanks for helping me!
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

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

Re: [FFmpeg-user] The option of -hwaccel device doesn't works well(FFmpeg n3.4)

2017-11-05 Thread James Girotti
I wonder if Gpu devices can not be selected if hwupload_cuda filter is
present.

>
> I think it's uploading to GPU 0 by default. There is an option 'device'
for
> hwupload_cuda. Could you try specifying the device for hwupload_cuda?


Could you try the 'device' option for hwupload_cuda?
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

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

Re: [FFmpeg-user] The option of -hwaccel device doesn't works well(FFmpeg n3.4)

2017-11-04 Thread James Girotti
On Fri, Nov 3, 2017 at 7:48 PM, Baek Seung Hoon 
wrote:

> Hello,
> Thanks to your reply :-)
>
> As your mentions, Hw decoder already has resize option.
> Why I use scale_npp filter with Sw decoder is Hw decoder(=cuvid) couldn't
> read some of video files while Sw decoder(=h264) could read it.
> So I choose a decoder this way -> use the Sw decoder if Hw decoder failed
> read video file.
>

Like I mentioned; not really a problem to use sw-decoder. You should use
whatever you want/need.


> Your reply message is helpful to me ^^.
> But I have a problem what same as previous mail.
> In case that I use both Sw decoder and Hw encoder with below command, and
> Only GPU0 encoder have working.
> I did change option as -gpu 0 or -gpu 1, it doesn't affect.
>

Have you tried using sw-decoder->hw-decoder without scale-npp? Something
like:

ffmpeg -i ./input.mp4 -c:v h264_nvenc -gpu 1 -c:a copy ./output.mp4

Does that use the correct GPU?

I assume that "hwupload_cuda" have a unknown bug because "gpu" option was
> works well when I remove "hwupload_cuda".
>

I think it's uploading to GPU 0 by default. There is an option 'device' for
hwupload_cuda. Could you try specifying the device for hwupload_cuda?
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

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

Re: [FFmpeg-user] The option of -hwaccel device doesn't works well(FFmpeg n3.4)

2017-11-02 Thread James Girotti
Hello,

Let me start by saying that I only have one NVENC capable GPU, so I cannot
test this. I hope to point you in the right direction though.

On Thu, Nov 2, 2017 at 7:38 PM, Baek Seung Hoon 
wrote:

> Could you tell me how can I select gpu device with FFmpeg CLI in this
> problem?
>

For all of the nvenc encoders there is a '-gpu' option: "Selects which
NVENC capable GPU to use. First GPU is 0, second is 1, and so on. (from -2
to INT_MAX) (default any)"

The cuvid decoders have similar '-gpu' options.


> **
> *Below is test command*
> 1. The first gpu device(index is 0) is always working although input option
> is hwaccel_device 1.
> $) ffmpeg -hwaccel_device 1 -y -i ./input.mp4 -filter_complex
> "[0:v]hwupload_cuda,scale_npp=w=960:h=540:format=yuv420p:
> interp_algo=lanczos,setsar=1[map0]"
> -map [map0] -c:v h264_nvenc -vprofile high -map 0:a -c:a copy  ./output.mp4
>
>
The above command doesn't use a hw-decoder (not a real problem if that's
what you want.) But I'm not sure if the '-hwaccel_device' option does
anything without something like '-hwaccel cuvid' and specifying '-c:v
h264_cuvid' before '-i ./input.mp4'.


> 2. If I remove "hwupload_cuda" options in filter_complex, hwaccel_device
> option works well.
> $) ffmpeg -hwaccel_device 1 -hwaccel cuvid -y -c:v h264_cuvid -i
> ./input.mp4 -filter_complex
> "[0:v]scale_npp=w=960:h=540:format=yuv420p:interp_algo=
> lanczos,setsar=1[map0]"
> -map [map0] -c:v h264_nvenc -vprofile high -map 0:a -c:a copy ./output.mp4
>

This command is significantly different from the previous. It's more than
just removing "hwupload_cuda". This command uses hw-decoding, which is why
you don't have to "hwupload_cuda" because the frames are already in GPU
memory. Also, likely why '-hwaccel_device 1' works.

I see that you are using scale_npp to resize your video and I would be
amiss if I did not mention that the cuvid decoders have resizing and
cropping built in now. You don't need to use scale_npp to scale/resize, you
could do something as simple as:

ffmpeg -hwaccel_device 1 -hwaccel cuvid -c:v h264_cuvid -resize 960x540 -i
./input.mp4 -vf "setsar=sar=1" -c:v h264_nvenc -vprofile high -map 0:a -c:a
copy ./output.mp4

I hope that help!
-J
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

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

Re: [FFmpeg-user] nvenc burn subtitles while transcoding

2017-10-24 Thread James Girotti
>
> Shouldn't I be using hwupload_cuda, to upload frames to the CUDA engine,
> then apply overlay filter and after that download it back? At least I
> understood it that way. Or you are suggesting to download it from CUDA
> run on CPU and after that upload it back.
>

No, the overlay filter is software only so it runs on CPU in main memory.
The hw-decoded frames have to be downloaded from GPU memory to main memory,
then the CPU applies the overlay filter in main memory, finally upload the
frame from main memory to GPU memory for hw-encoding.

I am trying something like this, but I don't exactly know where to
> upload it:
> ffmpeg -hwaccel cuvid -c:v h264_cuvid  -i udp://239.255.6.2:1234
> -filter_complex "[i:0x4b1]scale_npp=w=1920:h=1080,hwdownload,format=nv12
> [base]; [base][i:0x4ba]overlay[v]" -map [v] -map i:0x4b2 -c:a libfdk_aac
> -profile:a aac_he -ac 2 -b:a 64k -ar 48000 -c:v h264_nvenc -preset llhq
> -rc vbr_hq -qmin:v 19 -qmax:v 21 -b:v 2500k -maxrate:v 5000k -profile:v
> high -f flv rtmp://127.0.0.1/live/test
>
> It works, but I don't see any acceleration probably because it is not in
> CUDA anymore and the manual is not really helpful here. Anybody with
> more experience?
>

I'm not sure what you mean by "I don't see any acceleration". The syntax
looks okay for hw-decoding/encoding, so that should be happening on your
GPU. You can monitor your GPU using "nvidia-smi dmon" during transcoding.
It will show you how much your GPU is using for decoding/encoding (to
verify that your GPU is "doing work").

Do you mean that transcoding is slow? That should be expected. Doing a
similar overlay runs at ~4X on my Phenom X2/GTX1050Ti, where pure
hw-transcoding (no overlay) can do ~23X (with resizing to 1080p). ~10X and
~110X without resizing at 480p. As above, overlay filter is a
software-based filter. I don't know the exact overlay filter internals, but
based on performance I'm guessing it's single-threaded so that could cause
a major slow-down as the encoder is waiting for each single frame from the
overlay filter to be done by your "slow" single-core CPU.

Also just a side-note, it looks like you're scaling your input video before
overlaying using scale_npp. Not sure if you're aware, but the h264_cuvid
decoder has resizing and cropping built in. So you don't need to use
scale_npp to do the resizing. You could do something like:

ffmpeg -hwaccel cuvid -c:v h264_cuvid  -resize 1920x1080 -i udp://
239.255.6.2:1234 -filter_complex "[i:0x4b1]hwdownload,format=nv12[base];
[base][i:0x4ba]overlay[v]; [v]hwupload_cuda[v]" -map "[v]"  ...

Interestingly, if you wanted to overlay, then resize. You could use
scale_npp for GPU/CUDA resizing after overlay. The hw-decoder couldn't be
used to resize at that point. That would be something like:

ffmpeg -hwaccel cuvid -c:v h264_cuvid  -i udp://239.255.6.2:1234
-filter_complex "[i:0x4b1]hwdownload,format=nv12[base];
[base][i:0x4ba]overlay[v];
[v]hwupload_cuda,scale_npp=w=1920:h=1080:format=nv12[v]"
-map "[v]" ..

Or maybe you could resize the subtitles before overlay (you could try
something similar with scale_npp instead of scale):

ffmpeg -hwaccel cuvid -c:v h264_cuvid  -resize 1920x1080 -i udp://
239.255.6.2:1234 -filter_complex "[i:0x4b1]hwdownload,format=nv12[base];
[i:0x4ba]scale=1920:1080[subtitle]; [base][subtitle]overlay[v];
[v]hwupload_cuda[v]" -map "[v]" .

If you're still reading: scale_npp uses CUDA whereas h264_cuvid resizing
uses the GPU Video Engine. You (or anyone really) might take that into
consideration when planning to do resizing as those options would put
different kinds of loads on your GPU.

Hope This Helps (or at least points you in the right direction)!
-J
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

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

Re: [FFmpeg-user] nvenc burn subtitles while transcoding

2017-10-20 Thread James Girotti
>
> When I add hw acceleration for decoding I stops. Any ideas what can I try?
>
>
Not exactly sure how it works with filter_complex, but with regular filter
you would do something like:

"hwdownload,format=nv12,YOUR_FILTERS_HERE,format=yuv420p,hwupload_cuda"

This will grab the decoded frames from GPU memory, convert to nv12 (from
cuda format), then apply whatever filter you need, change the format to
something reasonable (my example uses yuv420p, then upload frames back to
GPU memory

Hope that helps,
-J
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

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

Re: [FFmpeg-user] feature proposal - avoid overwriting the input file

2017-10-10 Thread James Girotti
On Tue, Oct 10, 2017 at 4:40 PM, Mikhail V  wrote:

> Currently it is possible to delete the input file if I specify same
> filename in output,
> for example:
>
> ffmpeg -y -i input input
>

Aren't you specifying that with '-y' you want to "overwrite output file
without asking"


> or simply:
> ffmpeg -i input input
> (this will promt y/n)
>

I believe this is the default behavior for any output file that is present
whether it matches input or not (in my example both foo.mkv and bar.mkv
file present):

ffmpeg -i foo.mkv bar.mkv
Input #0, matroska,webm, from 'foo.mkv':
  Metadata:
ENCODER : Lavf57.71.100
  Duration: 01:00:30.05, start: 0.00, bitrate: 5195 kb/s
Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1920x1080 [SAR
1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc (default)
Metadata:
  ENCODER : Lavc57.89.100 h264_nvenc
  DURATION: 01:00:30.04700
Stream #0:1: Audio: aac (LC), 48000 Hz, 5.1, fltp (default)
Metadata:
  ENCODER : Lavc57.89.100 aac
  DURATION: 01:00:30.02100
File 'bar.mkv' already exists. Overwrite ? [y/N]


> So this will immideately destroy the input file.
> It did not happened with me often, but still happened a pair of times.
>

That is why almost never user '-y' and only if I am 100% certain it is
safe. Which in my case are FIFOs


> Was quite funny actually :) Funniest thing that I could not recover the
> file
> because it is same name.
>

That reminds me of when I accidentally did 'rm -rf /*'


>
> So, it would be nice if ffmpeg compare the output path with all input paths
> and exit with an error.
>

Is it possible for you to run your command without '-y' or if you're using
a script, then to compare your input and output before passing them to
ffmpeg?
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

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

Re: [FFmpeg-user] webcam streaming to youtube

2017-09-12 Thread James Girotti
On Mon, Sep 11, 2017 at 12:43 PM, Daniel <5960...@gmail.com> wrote:

> Hello everyone
>
> I am trying to stream my webcam to youtube. Here is the command i use:
>
> ffmpeg -re -f v4l2  -input_format mjpeg -s 640x480 -hwaccel cuvid -c:v
> mjpeg_cuvid  -i /dev/video1 -c:v libx264   -an -f flv rtmp://
> a.rtmp.youtube.com/live2/key
>
and the error i get :
>
> ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers
>   built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
>   configuration: --enable-gpl --enable-libass --enable-libfdk-aac
> --enable-libfreetype --enable-libmp3lame --enable-libopus
> --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264
> --enable-libx265 --enable-nonfree --enable-cuda --enable-cuvid
> --enable-nvenc --bindir=/usr/bin
>   libavutil  55. 58.100 / 55. 58.100
>   libavcodec 57. 89.100 / 57. 89.100
>   libavformat57. 71.100 / 57. 71.100
>   libavdevice57.  6.100 / 57.  6.100
>   libavfilter 6. 82.100 /  6. 82.100
>   libswscale  4.  6.100 /  4.  6.100
>   libswresample   2.  7.100 /  2.  7.100
>   libpostproc54.  5.100 / 54.  5.100
> Input #0, video4linux2,v4l2, from '/dev/video1':
>   Duration: N/A, start: 8778.032889, bitrate: N/A
> Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown),
> 640x480, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
> Stream mapping:
>   Stream #0:0 -> #0:0 (mjpeg (mjpeg_cuvid) -> h264 (libx264))
> Press [q] to stop, [?] for help
> [mjpeg_cuvid @ 0x2b31700] ignoring invalid SAR: 0/0
> Impossible to convert between the formats supported by the filter
> 'Parsed_null_0' and the filter 'auto_scaler_0'
>

This above message tells you there is a problem changing pixel formats.
You've commanded for "-hwaccel cuvid" so pixel format is cuda coming out of
the hw-decoder, but libx264 does not support cuda pixel format. If you
increased your verbosity, you would see that more clearly.

You have a few options. I don't know if youtube supports yuvj422p (which it
looks like your input is), I believe they recommend yuv420p for h264. You
should investigate further if they support yuvj422p if you want to use
that. I will include some examples, change them to fit your exact case:

1. Do not use "-hwaccel cuvid". It will still decode the frames in hw, but
ffmpeg will be working with frames in main/system RAM and not GPU RAM. This
first one ouptuts yuv420p

ffmpeg -c:v mjpeg_cuvid -i foo.mkv -c:v libx264 -an bar-yuv420p.mkv

ffmpeg -c:v mjpeg_cuvid -i foo.mkv -c:v libx264 -pix_fmt yuvj422p -an
bar-yuvj422p.mkv

2. Use a filter to download frames from GPU RAM and change the pixel
format. This is basically like the first option, decode in hw and download
frames to main memory. You have to specify format because libx264 does not
support cuda pixel format. NV12 is the only common format between those two.

ffmpeg -hwaccel cuvid -c:v mjpeg_cuvid -i foo.mkv -c:v libx264 -filter:v
"hwdownload,format=nv12" -an bar-yuv420p.mkv

ffmpeg -hwaccel cuvid -c:v mjpeg_cuvid -i foo.mkv -c:v libx264 -filter:v
"hwdownload,format=nv12" -pix_fmt yuvj422p -an bar-yuvj422p.mkv

3. Use full hw transcoding (NVenc does not support yuvj422p so you'll have
to decide what format is best for you):

ffmpeg -hwaccel cuvid -c:v mjpeg_cuvid -i foo.mkv -c:v h264_nvenc -an
bar-yuv420p.mkv

To chance pixel format (this does pixel format conversion in sw, so it
might be slower and use a lot of system resources):

ffmpeg -hwaccel cuvid -c:v mjpeg_cuvid -i foo.mkv -c:v h264_nvenc -filter:v
"hwdownload,format=nv12,format=yuv444p,hwupload_cuda" -an bar-yuv444p.mkv

4. Use full sw transcoding (this might be just as fast as hw->sw
transcoding. Decoding on modern cpu is fast, but it does use more system
resources.)

ffmpeg -i foo.mkv -c:v libx264 -an bar-yuv420p.mkv

ffmpeg -i foo.mkv -c:v lib264 -pix_fmt yuvj422p -an bar-yuvj422p.mkv


> Error reinitializing filters!
> Failed to inject frame into filter network: Function not implemented
> Error while processing the decoded data for stream #0:0
> [video4linux2,v4l2 @ 0x2b2f9a0] Some buffers are still owned by the caller
> on close.
> Conversion failed!
>
>
> if anyone has idea how to stream the webcam and what i am doing wrong
> please let me know.
>
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

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

Re: [FFmpeg-user] mp4 files size problem

2017-09-07 Thread James Girotti
On Thu, Sep 7, 2017 at 9:52 AM, Daniel <5960...@gmail.com> wrote:

> Thank you for the reply . I think you are right about the hardware encoder
> . I have encoded the video with libx264 and the output file was 189MB. Do
> you know what is the difference between nvenc_h264 and h264_nvenc  encoders
> ?


From what I can tell from the source code "nvenc_h264" is an alias for
"h264_nvenc", but "nvenc_h264" is the old deprecated name. So you if you're
writing any scripts/programs you should use "h264_nvenc"
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

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

Re: [FFmpeg-user] av_interleaved_write_frame(): Broken pipe

2017-08-30 Thread James Girotti
On Wed, Aug 30, 2017 at 7:56 AM, tasos  wrote:

> Maybe i should send it to the devs list?


My understanding is that the devs list is for software development and not
user interaction/support. I appreciate that you need help, this is a
volunteer effort though and it can take some time to get an answer. It's
taking me some time to study what you're experiencing and try to setup a
similar situation on my computer. Seems like I'll have to setup ffserver to
replicate the udp/rtmp part.

On 8/28/2017 7:13 PM, tasos wrote:

> Hello.
> I'm having a problem which i don't know if it's a bug or misuse from my
> side.
> I have attached the ffmpeg command and ffprobe of the input.
> The command was
>
> ./ffmpeg -y -hwaccel cuvid -deinterlace -vsync 1 -i udp://127.0.0.1:
>> -vcodec h264_nvenc -pix_fmt yuv420p -b:v 1000k -an -loglevel warning -f flv
>> rtmp://foobar:5130/live/foo/livestream
>>
>
Just a little bit of clean-up: you don't have to use "-hwaccel" because
you're not using a hw-decoder/full hw transcoding. Also "-deinterlace" is
deprecated (see ffmpeg -h long | grep 'deint'). I can see that your input
is yuv422p, which is not supported by h264_cuvid (that's too bad...) hence
why you're using sw-decoder.

I would recommend that you use a higher loglevel (like "debug" which also
== "48") to get more info on what's happening. Use "-t 5" or something
similar so the log output isn't too long.

In case i use the following command it will work:
>>
>> ./ffmpeg -y -hwaccel cuvid -deinterlace -vsync 1 -i udp://127.0.0.1:
>>> -vcodec h264_nvenc -pix_fmt yuv420p -b:v 1000k -an -loglevel warning
>>> foobar.mkv
>>>
>>
It's good to have something that works to use for troubleshooting. Did you
include the log output for this command that works? I'm surprised that the
above command works because the only difference is the output format. It
seems like it's something with RTMP then. I'm not very familiar with RTMP,
but can you try sending a local file (like the one you already transcoded)
to the RTMP server:

ffmpeg -loglevel debug -i foobar.mkv -c copy -f flv
rtmp://foobar:5130/live/foo/livestream


> Thanks in advanced!
>>
>
> ___
> ffmpeg-user mailing list
> ffmpeg-user@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

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

Re: [FFmpeg-user] missing h264_cuvid

2017-08-10 Thread James Girotti
On Thu, Aug 10, 2017 at 3:43 AM, Alex Molon 
wrote:

> I think the problem is more on the decoder you are using.
> Apparently your ffmpeg is compiled to support cuvid but if your stream
> is dvb-s mpeg2 maybe you should use this decoder:
>
> V. mpeg2_cuvid  Nvidia CUVID MPEG2VIDEO decoder (codec
> mpeg2video)
>

It is true that you cannot use the h264_cuvid decoder for mpeg2 streams and
the OP should be using "mpeg2_cuvid", the error the OP is getting is not
the error that you would get if you tried that though (foo.ts is a random
mpeg2/mpegts file on my computer):

ffmpeg -analyzeduration 1 -c:v h264_cuvid -i ./foo.ts

[h264 @ 0x201b950] non-existing PPS 2 referenced
Last message repeated 1 times
[h264 @ 0x201b950] SEI type 13 size 1304 truncated at 96
[h264 @ 0x201b950] Reducing left cropping to 0 chroma samples to preserve
alignment.
[h264 @ 0x201b950] crop values invalid 0 2 49 2 / 32 192
[h264 @ 0x201b950] sps_id 2 out of range
[h264 @ 0x201b950] non-existing PPS 0 referenced
[h264 @ 0x201b950] missing picture in access unit with size 14493
[h264 @ 0x201b950] non-existing PPS 2 referenced
[h264 @ 0x201b950] Invalid NAL unit 0, skipping.
Last message repeated 5 times
[h264 @ 0x201b950] non-existing PPS 2 referenced
[h264 @ 0x201b950] decode_slice_header error
[h264 @ 0x201b950] data partitioning is not implemented. Update your FFmpeg
version to the newest one from Git. If the problem still occurs, it means
that your file has a feature which has not been implemented.
[h264 @ 0x201b950] If you want to help, upload a sample of this file to
ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing
list. (ffmpeg-de...@ffmpeg.org)
[h264 @ 0x201b950] data partitioning is not implemented. Update your FFmpeg
version to the newest one from Git. If the problem still occurs, it means
that your file has a feature which has not been implemented.
[h264 @ 0x201b950] If you want to help, upload a sample of this file to
ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing
list. (ffmpeg-de...@ffmpeg.org)
[h264 @ 0x201b950] data partitioning is not implemented. Update your FFmpeg
version to the newest one from Git. If the problem still occurs, it means
that your file has a feature which has not been implemented.
[h264 @ 0x201b950] If you want to help, upload a sample of this file to
ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing
list. (ffmpeg-de...@ffmpeg.org)
[h264 @ 0x201b950] no frame!
[h264 @ 0x201b950] A non-intra slice in an IDR NAL unit.
[h264 @ 0x201b950] decode_slice_header error
[h264 @ 0x201b950] no frame!
[h264 @ 0x201b950] SEI type 13 size 1304 truncated at 89
[h264 @ 0x201b950] Reducing left cropping to 0 chroma samples to preserve
alignment.
[h264 @ 0x201b950] crop values invalid 0 2 49 2 / 32 192
[h264 @ 0x201b950] Reducing left cropping to 0 chroma samples to preserve
alignment.
[h264 @ 0x201b950] crop values invalid 0 2 49 2 / 32 192
[h264 @ 0x201b950] Reducing left cropping to 0 chroma samples to preserve
alignment.
[h264 @ 0x201b950] crop values invalid 0 2 49 2 / 32 192
[h264 @ 0x201b950] sps_id 2 out of range
[h264 @ 0x201b950] non-existing PPS 0 referenced
[h264 @ 0x201b950] decode_slice_header error
[h264 @ 0x201b950] no frame!
[h264 @ 0x201b950] data partitioning is not implemented. Update your FFmpeg
version to the newest one from Git. If the problem still occurs, it means
that your file has a feature which has not been implemented.
[h264 @ 0x201b950] If you want to help, upload a sample of this file to
ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing
list. (ffmpeg-de...@ffmpeg.org)
[h264 @ 0x201b950] data partitioning is not implemented. Update your FFmpeg
version to the newest one from Git. If the problem still occurs, it means
that your file has a feature which has not been implemented.
[h264 @ 0x201b950] If you want to help, upload a sample of this file to
ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing
list. (ffmpeg-de...@ffmpeg.org)
[h264 @ 0x201b950] data partitioning is not implemented. Update your FFmpeg
version to the newest one from Git. If the problem still occurs, it means
that your file has a feature which has not been implemented.
[h264 @ 0x201b950] If you want to help, upload a sample of this file to
ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing
list. (ffmpeg-de...@ffmpeg.org)
[h264 @ 0x201b950] no frame!
[h264 @ 0x201b950] non-existing PPS 2 referenced
[h264 @ 0x201b950] decode_slice_header error
[h264 @ 0x201b950] no frame!
[mpegts @ 0x2017330] decoding for stream 0 failed
[mpegts @ 0x2017330] PES packet size mismatch
[mpegts @ 0x2017330] Could not find codec parameters for stream 0 (Video:
h264 ([2][0][0][0] / 0x0002), none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize'
options
[mpegts @ 0x2017330] Could not find codec parameters for stream 2 (Unknown:
none 

Re: [FFmpeg-user] ffmpeg reported fps different than actual file's

2017-08-02 Thread James Girotti
On Wed, Aug 2, 2017 at 3:09 PM, tasos  wrote:

> Hello again.
> A lot of information and i'm trying to process them.
> I know a few basic things about video processing in general.
> Anyway,the specific dvb source channel is quite strange or at least this
> is how it looks
> to me.
>
>> Is this the ffprobe output from the file or your DVB capture device? I
>> politely request you provide full command lines and output in the future.
>>
>
> That was from the file.
>
>
> Can you dump directly from the device to file without using ffmpeg? I.E.:
>>
> Yes i can.
>

That should make troubleshooting much easier! Glad you're able to do that.


>
> ffprobe -v error -select_streams v:0 -show_entries  \
>> stream=r_frame_rate,avg_frame_rate -of default=nw=1 ./foo.ts
>>
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] decode_slice_header error
>> [h264 @ 0x4088420] no frame!
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] decode_slice_header error
>> [h264 @ 0x4088420] no frame!
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] decode_slice_header error
>> [h264 @ 0x4088420] no frame!
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] decode_slice_header error
>> [h264 @ 0x4088420] no frame!
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] decode_slice_header error
>> [h264 @ 0x4088420] no frame!
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] decode_slice_header error
>> [h264 @ 0x4088420] no frame!
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] decode_slice_header error
>> [h264 @ 0x4088420] no frame!
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] decode_slice_header error
>> [h264 @ 0x4088420] no frame!
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] decode_slice_header error
>> [h264 @ 0x4088420] no frame!
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] decode_slice_header error
>> [h264 @ 0x4088420] no frame!
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] decode_slice_header error
>> [h264 @ 0x4088420] no frame!
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] decode_slice_header error
>> [h264 @ 0x4088420] no frame!
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] decode_slice_header error
>> [h264 @ 0x4088420] no frame!
>> [h264 @ 0x4088420] SPS unavailable in decode_picture_timing
>> [h264 @ 0x4088420] non-existing PPS 0 referenced
>> [h264 @ 0x4088420] SPS unavailable in 

Re: [FFmpeg-user] ffmpeg reported fps different than actual file's

2017-08-02 Thread James Girotti
On Tue, Aug 1, 2017 at 3:22 PM, tasos  wrote:

> Hello and thanks for replying.
> This is what ffprobe gives me(i should have mentioned it earlier)
>
> Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuv420p(tv,
>> bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 5593 kb/s, 50 fps, 25 tbr,
>> 50 tbn, 50 tbc
>>
>
>
Is this the ffprobe output from the file or your DVB capture device? I
politely request you provide full command lines and output in the future.


>
> On 8/2/2017 1:01 AM, Simon Brown wrote:
>
>> On 1 August 2017 at 22:59, tasos  wrote:
>>
>> Hello.
>>> I get a video file with
>>>
>>> ffmpeg -y   -i /dev/dvb/adapter0/dvr0 -c:v copy -c:a copy   foo.avi
>>> This file is displayed  on vlc  as a 50fps video file.
>>>
>>> Input #0, mpegts, from '/dev/dvb/adapter0/dvr0':
>>>
Duration: N/A, start: 7972.129344, bitrate: N/A
Program 1
  Stream #0:0[0x6e]: Video: h264 (High) ([27][0][0][0] / 0x001B),
 yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25
 tbr, 90k tbn, 50 tbc
  Stream #0:1[0x78]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz,
 stereo, s16p, 128 kb/s
  Stream #0:2[0x82]: Audio: mp3 ([3][0][0][0] / 0x0003), 0 channels,
 s16p
>>>
>>>
Can you dump directly from the device to file without using ffmpeg? I.E.:

dd if=/dev/dvb/adapter0/dvr0 of=./foo.ts bs=1M count=100

Then analyze that file with ffprobe and VLC to see what the reported
frame-rate is.

If you can't dump directly from the device node to file, then try keeping
the same container/format (I add "-t 30" so that we only get 30 seconds of
video):

ffmpeg -i /dev/dvb/adapter0/dvr0 -t 30 -c copy -f mpegts ./foo.ts

Example FFPROBE output from a random interlaced video on my computer:

ffprobe -v error -select_streams v:0 -show_entries
stream=r_frame_rate,avg_frame_rate -of default=nw=1 ./JG-FOO.ts

r_frame_rate=6/1001
avg_frame_rate=3/1001

VLC reports a frame-rate of 3/1001 for JG-FOO.ts


>>> My guess is that VLC is misreporting it, and it's 50 fields per second,
>>>
>> interlaced, and so FFMpeg is reporting it as 25 frames per second
>> correctly.
>>
>
Let's do an experiment; my hypothesis is that when it is muxed to AVI the
frame-rate is changed for some reason. Are half-frames/fields counted as
full-fields/frames???

Take JG-FOO.ts from above and mux to AVI:

ffmpeg -v info -ss 5:00 -i ./JG-FOO.ts -c copy -t 10 ./JG-FOO.avi
Input #0, mpegts, from 'JG-FOO.ts':
  Duration: 01:05:01.45, start: 1.40, bitrate: 16261 kb/s
  Program 1
Metadata:
  service_name: Service01
  service_provider: FFmpeg
Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002),
yuv420p(tv, top first), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions,
29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x101]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz,
5.1(side), fltp, 384 kb/s
Output #0, avi, to './JG-FOO.avi':
  Metadata:
ISFT: Lavf57.56.101
Stream #0:0: Video: mpeg2video (Main) (mpg2 / 0x3267706D), yuv420p(tv,
top first), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 59.94 tbr,
59.94 tbn, 59.94 tbc
Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), 384
kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[avi @ 0xbf2690] Non-monotonous DTS in output stream 0:0; previous: 127,
current: 127; changing to 128. This may result in incorrect timestamps in
the output file.
[avi @ 0xbf2690] Non-monotonous DTS in output stream 0:0; previous: 277,
current: 277; changing to 278. This may result in incorrect timestamps in
the output file.
[avi @ 0xbf2690] Non-monotonous DTS in output stream 0:0; previous: 427,
current: 427; changing to 428. This may result in incorrect timestamps in
the output file.
frame=  242 fps=0.0 q=-1.0 Lsize=7660kB time=00:00:10.01
bitrate=6268.5kbits/s speed= 406x
video:7154kB audio:481kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.316611%

Now take a look at the frame-rates:

ffprobe -v error -select_streams v:0 -show_entries
stream=r_frame_rate,avg_frame_rate -of default=nw=1 ./JG-FOO.avi

r_frame_rate=6/1001
avg_frame_rate=6/1001

So my results show the frame rates have been doubled. Also, it shows
6/1001 FPS using VLC. I think that's basically what you're seeing also

Try setting rate:

ffmpeg -v info -ss 5:00 -i ./JG-FOO.ts -c copy -t 10 -r 3/1001
./JG-FOO-r30.avi
Input #0, mpegts, from 'JG-FOO.ts':
  Duration: 01:05:01.45, start: 1.40, bitrate: 16261 kb/s
  Program 1
Metadata:
  service_name: Service01
  service_provider: FFmpeg
Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002),
yuv420p(tv, top first), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions,
29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x101]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz,
5.1(side), 

Re: [FFmpeg-user] Error:Impossible to convert between the formats supported by the filter..

2017-07-29 Thread James Girotti
On Jul 29, 2017 1:04 PM, "tasos" <tas...@trigonongroup.com> wrote:

Hello again Sir!
I was avoiding to disturb you but i can't find a solution on my problem
again!


Please email the list and not me directly. I would like for the whole
community to be involved.

First of all,my sources are interlaced so i want to deinterlace them.
Every time i use
time ffmpeg -y -hwaccel cuvid -c:v h264_cuvid  -deint 1 or -deint 2
the resulted video stalls/freezes then continues and this goes on and on.


I have not done deinterlacing with cuda h264 decoder. I have not had good
results from the adaptive deinterlacing and mixed results with bob if the
source isn't >75% interlaced.

That part of your command looks fine, but I usually use words for the
-deint argument instead of numbers, shouldn't be a problem though.


So i have 2 questions.
1)How can i perform proper deinterlacing , i suppose using cuda/hardware.
2) Every time i run the following


 time ffmpeg -y -hwaccel cuvid -c:v h264_cuvid  \
-i http://85.196.57.134:8001/1:0:1:1:0:0:0:0:0:0: \
   -strict experimental  \
   -vf  "hwupload_cuda,scale_npp=w=1280:h=-1:format=yuv420p:
interp_algo=lanczos,hwdownload,format=yuv420p" \
   -c:v h264_nvenc \
   -zerolatency true \
   -preset ll \
   -r 25 -g 50 -qmin 1 -qmax 50 \
   -b:v 1M -maxrate 1M -bufsize 2M \
   -codec:a aac -b:a 64k   \
   -f flv rtmp://foobar

i get again the same old error!


Impossible to convert between the formats supported by the filter 'graph 0
input from stream 0:0' and the filter 'auto_scaler_0'


Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #0:0


Your filter order is mixed-up. Scale-npp filter uses cuda context. So you
don't have to hwdownload or hwupload_cuda for just scale-npp.

Sorry, I'm away from my computer, does scale-npp have an option for format?
Also, unless you are changing format, I don't think you have to include
that as your source is yuv420p. Anyway, you have the same problem as
before. The last format statement in your filter parameters would be a
software filter, see my last email if you really want to change pixel
format.


Of course if i remove hwupload_cuda then everything works fine.
I have used scale_npp because i wanted to scale on hardware and now i can't
use it(or at least hwupload_cuda is not accepted).
What am i doing wrong?


Thank you very much and if you want me to post this email on the mailing
list please let me know(so people will know that you have answered my
question again).

ps:I was reading http://developer.download.nvidia.com/compute/redist/
ffmpeg/1511-patch/FFMPEG-with-NVIDIA-Acceleration-on-Ubuntu_UG_v01.pdf
and there is a patch for ffmpeg http://developer.download.
nvidia.com/compute/redist/ffmpeg/1511-patch/ffmpeg_
NVIDIA_gpu_acceleration.patch
in order to enable the  --enable-nvresize option. Of course this patch is
for a specific git commit(2015).I was wondering about nvresize and if you
know something more.


From what I've read nvresize is the same as scale-npp or it was depricated.
It certainly is in newest ffmpeg version.

That said:

I'm way ahead of myself. I should have asked in the beginning which version
of ffmpeg you're using. My answers will depend on your version. Also, send
the output of:

ffmpeg -h decoder=h264_cuvid

And

ffmpeg -h filter=scale_npp

-J

On 7/25/2017 1:24 AM, James Girotti wrote:



On Mon, Jul 24, 2017 at 2:57 PM, tasos <tas...@trigonongroup.com> wrote:

> Hello and thanks for replying.
> Your information is very useful and i thank you!
>

You're welcome!

My colleague uses an older version of ffmpeg and the specific combination
> (including pix_fmt)
>
>> ffmpeg -y -hwaccel cuvid-c:v h264_cuvid
>>
> works without any errors.That was my question.I thought i was doing
> something wrong or whatever.So i suppose that something has changed
> from his version until mine(git latest).
> So i have removed -pix_fmt yuv420p and everything works fine.
> I also would like to search about the hwdownload option you have entered.
>

This is important if you want to use any software video filters.


> I don't want to change the pixel format(i don't know why you have thought
> about it).
>

Just in case you were trying to change pixel format, I couldn't tell from
your initial email.


>
> Is this the correct way to go?
>
>> ffmpeg -y -hwaccel cuvid -c:v h264_cuvid -deint 1 -vsync 1 -timeout
>> 99 -i foo \
>> -map 0:v -c:v h264_nvenc -preset slow -profile:v high -b:v 1300k  -map
>> 0:a:0 -c:a libfdk_aac -ac 2 -b:a 64k -strict experimental  \
>> -f flv bar
>>
>
It looks fine as far as full hardware transcoding. I did get an error that
there is no such option '-timeout', so you might also encounter that. And
of course you can tweak the other parameters to your use-case, i.e. bitrate



Re: [FFmpeg-user] Error:Impossible to convert between the formats supported by the filter..

2017-07-24 Thread James Girotti
On Mon, Jul 24, 2017 at 11:15 AM, tasos  wrote:

> Hello.
> I'm using
>
>> ffmpeg -y  -c:v h264_cuvid -deint 1 -vsync 1 -timeout 99 -i foo \
>> -map 0:v -c:v h264_nvenc -preset slow -profile:v high -b:v 1300k -pix_fmt
>> yuv420p -map 0:a -c:a libfdk_aac \
>> -ac 2 -b:a 64k -strict experimental -f mpegts foobar
>>
> and everything works fine.
> When i add -hwaccel cuvid
>
> ffmpeg -y -hwaccel cuvid -c:v h264_cuvid .. the same as above
>>
> I get
>
>> Impossible to convert between the formats supported by the filter
>> 'Parsed_null_0' and the filter 'auto_scaler_0'
>> Error reinitializing filters!
>> Failed to inject frame into filter network: Function not implemented
>> Error while processing the decoded data for stream #0:4
>>
>
I have run into the same many times trying to do stuff with nvenc and
hwaccel. You're trying to apply a software filter, but you're telling
ffmpeg to do everything in hardware (-hwaccel), so it cannot apply the
filter hence the error. Doesn't matter though, as from what I can tell
nvenc will not change pixel formats for you. Your source is yuv420p, output
will be yuv420p. If you want to change output pixel format to yuv444p, you
could do something like:

ffmpeg -hwaccel cuvid -c:v h264_cuvid -i foo -c:v h264_nvenc -preset slow
-profile:v high444p \
-vf "hwdownload,format=nv12,format=yuv444p,hwupload_cuda" -an -f mpegts
./foobar.ts

This would do the pixel format conversion in software (you could do the
same for any software filter you might want to use). Nvenc then outputs in
yuv444p pixel format.

Of course if you convert to anything but yuv420p, then decoding with cuvid
will not work because only yuv420p is supported in hardware.
https://developer.nvidia.com/nvidia-video-codec-sdk#NVDECFeatures

HTH,
-James
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

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

Re: [FFmpeg-user] Seeking for a method to remove sections of a video

2017-06-19 Thread James Girotti
On Sun, Jun 18, 2017 at 9:50 AM, Carlos E. R. 
wrote:

> On 2017-06-18 15:02, Frank Tetzel wrote:
> >> Hi,
> >>
> >> I'm new to this list.
> >>
> >> I'm seeking for a tool to remove the start and end sections of a movie
> >> recorded from TV, plus sections on the middle (commercials), in
> >> Linux. I have tried several GUI tools and they are either too complex
> >> or lack some crucial feature (like handling two language audio
> >> tracks). Some tools are obsolete and abandoned, do not work
> >> (gopchop...).
> >>
> >> I have found that ffmpeg can do the perfect conversion and cutting.
> >>
> >> My problem is finding out the cut points.
> >>
> >> Thus what I seek is a GUI Wrapper for ffmpeg that allows me to move
> >> around the movie selecting start, end, and middle remove sections, and
> >> just generate a script for ffmpeg that I can then edit and adjust with
> >> my own options and run.
> >>
> >> I have tried, for instance, ffmpegyag. Well, it is incapable of
> >> visualizing my videos, so I can't select the cut points...
> >>
> >>
> >> The closest I have is finding the points with Xine, then manually
> >> concot the command line to generate sections, then concatenate using
> >> method in https://trac.ffmpeg.org/wiki/Concatenate
> >>
> >> I seek a GUI to automate generating the cut points in a list or
> >> script.
> >>
> >> Thanks :-)
> >>
> >
> > In the past I used avidemux for simple cutting jobs:
> > http://fixounet.free.fr/avidemux/
> >
> > Not sure if it can handle multiple audio tracks.
>
> It can't.
>
> I was told that version 3 can do it, but I tried and couldn't.
>
> > This is a full GUI application, not a ffmpeg frontend that you want.
> > Just mentioning it...
>
>
I ultimately run avidemux as a frontend to ffmpeg. I have avidemux save
(copy video and audio) to a FIFO which is then the input for my ffmpeg
command. From my limited testing that way supports multiple audio tracks.
It's not a perfect setup because you have to end cuts on key-frames, not
usually a problem for me though (you can start your cut wherever). Also,
you can see the PTS for a given frame in avidemux. So in the rare-case I
can manually tell ffmpeg where to cut a given segment. Generally, this is
the workflow I use.

Someone suggested mplayer with "--edlout=your_filename". I haven't tried
it, but it could give very accurate times without having to type them
yourself. The problem I foresee is that you cannot do backward frame steps.
That would end up frustrating me because I would likely go a frame too far
and then not have an accurate time.

Back in the day when I ran MythTV it was very easy to this kind of thing.
Their interface for this is great in my opinion. Within a couple minutes, I
could have all the commercials from a movie marked with accuracy to a
single-frame. MythTV is a lot to setup and run if you just want to cut
commercials though.

Good luck and let us know what you decide to use.

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

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