Re: [FFmpeg-user] Hello, I want to ask about sending very long argument into ffmpeg command line.

2019-11-04 Thread 김민성
Ok, let me explain in details.
 
I have to split one video into large amount(usually more than 1000) of segments 
and reassemble segments into one video. 
Suppose I try split only, then command will be like
 
ffmpeg -i input.mp4 -vcodec copy -acodec copy -ss 00:00:00 -t 00:01:00 -sn 
test_split001.mp4 -vcodec copy -acodec copy -ss 00:01:00 -t 00:02:00 -sn 
test_split002.mp4 -vcodec copy -acodec copy -ss 00:02:00 -t 00:13:50 -sn 
test_split003.mp4 -vcodec copy -acodec copy -ss 00:13:50 -t 00:19:27 -sn 
test_split004.mp4 ...
Currently I am sending just one command per extraction to the kernel, because 
kernel doesn't accept if given command is too long. 
Since I am making too many segments, efficiency is way too low.
 
This is why I asked you about modifying main(generating command arguments 
inside of main function). Did my answer cleared your question?
 
Thanks for reading this,
Minsung Kim
 
-Original Message-
From: "Ted Park"
To: "FFmpeg user questions";
Cc:
Sent: 2019-11-05 (화) 15:54:16 (GMT+09:00)
Subject: Re: [FFmpeg-user] Hello, I want to ask about sending very long 
argument into ffmpeg command line.
 
> Hello. My name is Minsung Kim, I want to ask about sending very long 
> arguments into ffmpeg command line.
>
> Since Linux kernel can't handle very long arguments, I am thinking steps 
> below.
>
> - Rename current "main" function from source code to "main2".
> - Make new "main" function, and generate long arguments in that function.
> - Pass that arguments into main2.
>
> Is this a good way to solve it? If I have to change more part of code, where 
> should I change it?

What are the “very long arguments”? If most of it’s a filter chain you can 
separate that into a file.
___
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".
___
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] Hello, I want to ask about sending very long argument into ffmpeg command line.

2019-11-04 Thread Ted Park
> Hello. My name is Minsung Kim, I want to ask about sending very long 
> arguments into ffmpeg command line.
> 
> Since Linux kernel can't handle very long arguments, I am thinking steps 
> below.
> 
> - Rename current "main" function from source code to "main2".
> - Make new "main" function, and generate long arguments in that function.
> - Pass that arguments into main2.
> 
> Is this a good way to solve it? If I have to change more part of code, where 
> should I change it?

What are the “very long arguments”? If most of it’s a filter chain you can 
separate that into a file.
___
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".

[FFmpeg-user] Hello, I want to ask about sending very long argument into ffmpeg command line.

2019-11-04 Thread 김민성
Hello. My name is Minsung Kim, I want to ask about sending very long arguments 
into ffmpeg command line.
 
Since Linux kernel can't handle very long arguments, I am thinking steps below.
 
- Rename current "main" function from source code to "main2".
- Make new "main" function, and generate long arguments in that function.
- Pass that arguments into main2.
 
Is this a good way to solve it? If I have to change more part of code, where 
should I change it?
 
Best regards,
Minsung Kim
___
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".

[FFmpeg-user] ffmpeg hwmap SW decoded frame to OpenCL and hwmap back to h264 for SW encode

2019-11-04 Thread Alex
I trying speed up process and avoid copy frames between GPU and CPU. But got 
error: "Segmentation fault: 11", so may be I'm doing something wrong?

My full ffmpeg command and log here:

./ffmpeg -i ../720.mp4 -init_hw_device opencl=ocl:0.1 -filter_hw_device ocl  
-filter_complex "hwmap,avgblur_opencl=30,hwmap"  -c:v h264 -an -t 10 -y 
../out_blur.mp4 -loglevel debug
ffmpeg version N-95621-g53c21c2d6b Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple LLVM version 10.0.0 (clang-1000.10.44.4)
  configuration: --enable-fontconfig --enable-gpl --enable-libaom 
--enable-libass --enable-libbluray --enable-libfreetype --enable-libtheora 
--enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 
--disable-ffplay --enable-nonfree --enable-opencl
  libavutil      56. 35.101 / 56. 35.101
  libavcodec     58. 60.100 / 58. 60.100
  libavformat    58. 33.100 / 58. 33.100
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 66.100 /  7. 66.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument '../720.mp4'.
Reading option '-init_hw_device' ... matched as option 'init_hw_device' 
(initialise hardware device) with argument 'opencl=ocl:0.1'.
Reading option '-filter_hw_device' ... matched as option 'filter_hw_device' 
(set hardware device used when filtering) with argument 'ocl'.
Reading option '-filter_complex' ... matched as option 'filter_complex' (create 
a complex filtergraph) with argument 
'hwmap,unsharp_opencl=lx=17:ly=17:la=5,hwmap'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 
'h264'.
Reading option '-an' ... matched as option 'an' (disable audio) with argument 
'1'.
Reading option '-t' ... matched as option 't' (record or transcode "duration" 
seconds of audio/video) with argument '10'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with 
argument '1'.
Reading option '../out_blur.mp4' ... matched as output url.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) 
with argument 'debug'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option init_hw_device (initialise hardware device) with argument 
opencl=ocl:0.1.
[AVHWDeviceContext @ 0x7fbb1ec08480] 1 OpenCL platforms found.
[AVHWDeviceContext @ 0x7fbb1ec08480] 3 OpenCL devices found on platform "Apple".
[AVHWDeviceContext @ 0x7fbb1ec08480] 0.1: Apple / HD Graphics 4000
Applying option filter_hw_device (set hardware device used when filtering) with 
argument ocl.
Applying option filter_complex (create a complex filtergraph) with argument 
hwmap,unsharp_opencl=lx=17:ly=17:la=5,hwmap.
Applying option y (overwrite output files) with argument 1.
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url ../720.mp4.
Successfully parsed a group of options.
Opening an input file: ../720.mp4.
[NULL @ 0x7fbb1f818c00] Opening '../720.mp4' for reading
[file @ 0x7fbb1ec3d600] Setting default whitelist 'file,crypto'
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fbb1f818c00] Format mov,mp4,m4a,3gp,3g2,mj2 
probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fbb1f818c00] ISO: File Type Major Brand: isom
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fbb1f818c00] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fbb1f818c00] Processing st: 0, edit list 0 - 
media time: 0, duration: 300300
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fbb1f818c00] Before avformat_find_stream_info() 
pos: 4123312 bytes read:34929 seeks:1 nb_streams:1
[h264 @ 0x7fbb1f9ae800] nal_unit_type: 7(SPS), nal_ref_idc: 1
[h264 @ 0x7fbb1f9ae800] nal_unit_type: 8(PPS), nal_ref_idc: 1
[h264 @ 0x7fbb1f9ae800] nal_unit_type: 6(SEI), nal_ref_idc: 0
[h264 @ 0x7fbb1f9ae800] nal_unit_type: 5(IDR), nal_ref_idc: 1
[h264 @ 0x7fbb1f9ae800] Format yuv420p chosen by get_format().
[h264 @ 0x7fbb1f9ae800] Reinit context to 1280x720, pix_fmt: yuv420p
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fbb1f818c00] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fbb1f818c00] After avformat_find_stream_info() 
pos: 38244 bytes read:73125 seeks:2 frames:1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../720.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.33.100
  Duration: 00:00:10.01, start: 0.00, bitrate: 3295 kb/s
    Stream #0:0(und), 1, 1/3: Video: h264 (High), 1 reference frame (avc1 / 
0x31637661), yuv420p(left), 1280x720 [SAR 1:1 DAR 16:9], 0/1, 3293 kb/s, 29.97 
fps, 29.97 tbr, 30k tbn, 60k tbc (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc. Created on: 
10/24/2018.
Successfully opened the file.
[Parsed_unsharp_opencl_1 @ 0x7fbb1ec45640] Setting 'lx' to value '17'
[Parsed_unsharp_opencl_1 @ 0x7fbb1ec45640] Setting 'ly' to value '17'

Re: [FFmpeg-user] Reducing video file size

2019-11-04 Thread Morten W. Petersen
There are different sources, with varying existing encodings, and
resolutions. So those numbers were just thrown out there.

How about 100KB per 10 seconds, or 1MB per minute? What's possible to
squeeze in, or out there?

Regards,

Morten

man. 4. nov. 2019, 19.18 skrev Ted Park :

> > Hm. Well is it possible to get down to 6 MB per minute, 1 MB per 10
> seconds?
>
>
> Oookay so 1MB = 1000KB = 976.5625KiB = 7812.5kbps.. Odd numbers @_@ is
> this for the whole file? Or video only?
>
> That sounds like a pretty typical target for 1080p, but like others have
> said you’ll have to try out all the options you listed that can use and see
> what the trade-offs are. If you know you definitely prioritize “x” then you
> can eliminate some of the options.
>
> For example, for multi-pass encodings, the bitrate can vary so while it
> may be 6MB per min at one point in the video, it might be over 1MB per 10
> seconds in some other part.
>
> Also, I’m not sure about this but changing to grayscale might not decrease
> the bitrate as much as you’d expect, depending on the source format.
>
> What is the source actually? I had thought you were trying to transcode a
> file, have I completely misunderstood? (Like do you have an intermediate
> format from a 4K 60fps sequence job or something other?)
> ___
> 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".
___
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] Reducing video file size

2019-11-04 Thread Ted Park
> Hm. Well is it possible to get down to 6 MB per minute, 1 MB per 10 seconds?


Oookay so 1MB = 1000KB = 976.5625KiB = 7812.5kbps.. Odd numbers @_@ is this for 
the whole file? Or video only?

That sounds like a pretty typical target for 1080p, but like others have said 
you’ll have to try out all the options you listed that can use and see what the 
trade-offs are. If you know you definitely prioritize “x” then you can 
eliminate some of the options.

For example, for multi-pass encodings, the bitrate can vary so while it may be 
6MB per min at one point in the video, it might be over 1MB per 10 seconds in 
some other part.

Also, I’m not sure about this but changing to grayscale might not decrease the 
bitrate as much as you’d expect, depending on the source format.

What is the source actually? I had thought you were trying to transcode a file, 
have I completely misunderstood? (Like do you have an intermediate format from 
a 4K 60fps sequence job or something other?)
___
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] Transcode with the some properties

2019-11-04 Thread Boris
Hello Mortiz,

Le lun. 4 nov. 2019 à 17:23, Moritz Barsnick  a écrit :

> Hi Boris,
>
> On Mon, Nov 04, 2019 at 10:29:10 +0100, Boris wrote:
> > Hello,
> > I want to transcode video with exactly the same properties of the input
> > video in the output video.
> > I use the transcoding.cc code. In the static int open_output_file(const
> > char *filename) function, I set  encoder parameters like this :
>
> This list (ffmpeg-users) is primarily for the use of the command line
> tool. For assistance with programming with the libav* libraries, please
> refer to the mailing list libav-user:
> https://ffmpeg.org/mailman/listinfo/libav-user
>
> Also please note that your code was wrapped in a fashion making it hard
> to read:
>
http://ffmpeg.org/pipermail/ffmpeg-user/2019-November/045902.html
>
> You may want to avoid line breaks in your mailer, or attach a text file
> instead.
>

Thank you. I will take into account your comments and suggestions .

>
> > But when I run exiftool on output  video and on input video, some values
> > like video duration, encoder, bit rate,  are differente.
> > Can someone tells me how can I do to keep the same parameters (metada) of
> > the input video in the output video, please?
>
> What are you exactly trying to achieve? If you want *exactly* the same
> characteristics, you should probably just copy the stream (and the
> metadata) instead of re-encoding.
>

My aim is  to manipulate motion vectors (+- operation) while transcoding.
But I want that the output video has as much as possible the same
properties as the output video.

>
> Duration and bitrate are not metadata.
>

Ok :).

>
> The encoder (metadata) will be different, because it is a different
> encoder. ;-) You can manipulate the metadata though.
>

Can you tell me how can I perform that ?

>
> If you correctly determine the source's bitrate, you should be able to
> set it for the encoding, and depending on the encoder, you may achieve
> the exact same rate.
>
> But the input stream may have more characteristics, such as:
> - VBR,
> - GOP size, or even
> - placement of I-frames,
> - use of B-frames
> and so on. Which of these do you want to duplicate, which not? And why?
>
> If you specify your actual needs more precisely, it may be easier to
> come up with a recipe to fulfill them. On the other list, of course.
> ;-)
>

Thank you so much. .

>
> Cheers,
> Moritz
>

Regards

> ___
> 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".
___
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] Reducing video file size

2019-11-04 Thread Morten W. Petersen


Yeah, you have half a point there.

Regards,

Morten


man. 4. nov. 2019, 17:55 skrev Ted Park :

> Well your first post kinda reads more like a Facebook status update more
> than a question, so...
> ___
> 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".
___
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] Reducing video file size

2019-11-04 Thread Morten W. Petersen
Hm. Well is it possible to get down to 6 MB per minute, 1 MB per 10 seconds?

Regards,

Morten

man. 4. nov. 2019, 17:48 skrev Ted Park :

> > Which codec gives the lowest size?
> >
> > Let me ask in a different way, how can I encode a video to the smallest
> > possible size, while still discerning some movement?
>
>
> Now we’re getting somewhere. x264/x265 are like the de facto gold
> standards for the software encoders for the ITU/ISO/IEC codecs, h.265 is
> more efficient wrt file size, and vpx is comparable if you need/prefer OAM
> family.
>
> It still sounds like all you want to do is compress the video until it is
> fubar, is there a maximum limit on the size that you need it to be? Because
> then multi-pass encoding could be an option.
> ___
> 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".
___
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] Reducing video file size

2019-11-04 Thread Ted Park
Well your first post kinda reads more like a Facebook status update more than a 
question, so...
___
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] Reducing video file size

2019-11-04 Thread Ted Park
> Which codec gives the lowest size?
> 
> Let me ask in a different way, how can I encode a video to the smallest
> possible size, while still discerning some movement?


Now we’re getting somewhere. x264/x265 are like the de facto gold standards for 
the software encoders for the ITU/ISO/IEC codecs, h.265 is more efficient wrt 
file size, and vpx is comparable if you need/prefer OAM family.

It still sounds like all you want to do is compress the video until it is 
fubar, is there a maximum limit on the size that you need it to be? Because 
then multi-pass encoding could be an option. 
___
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] Reducing video file size

2019-11-04 Thread Morten W. Petersen
Hi Daniel.

I would say a smoother flow is more important than resolution.

For now.

-Morten

man. 4. nov. 2019, 17:39 skrev Noeck :

> As others pointed out, this very much depends on what you want to
> achieve (besides a small file size). But I try to offer a starting point
> for you to try and find your own compromise of size and quality.
>
> Usually, I would use a resolution of 1920x1080 (HD), but 1280x720 might
> be an option to reduce the size. A frame rate of 25 frames per second
> could be enough. But with typical codecs you will not get half the file
> size by using half the frame rate. So 720p and 25 fps could be a
> starting point. What is more important to you: a high resolution or a
> smoothly moving image?
>
> Then the vp9 codec (libvpx-vp9) and opus audio does a good job regarding
> bitrate and a high CRF value reduces file size. Just try 32 and have a
> look if you can tolerate the quality reduction and file size.
>
> And only as a last resort go below a 480 resolution and 25 fps.
> Audio bitrate is typically much smaller than video and there is not a
> log to gain here. But with the opus codec you can go as low as 64kbit/s
> if need be.
>
> Of course there are many more ways to reach a small file size. The
> numbers above are in the ball park of what could be reasonable for a
> small web-quality video.
>
> Best,
> Daniel
>
>
> > Resolution
> > Frame rate
> > Color encoding
> > Compression/encoding
> > Audio bit rate & compression
> > (others)
> ___
> 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".
___
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] Reducing video file size

2019-11-04 Thread Reindl Harald


Am 04.11.19 um 17:22 schrieb Morten W. Petersen:
> You are unable to understand what I ask for, and send an email 2 minutes
> after I replied to Nicholas who gave a similar answer, when his lack of
> intelligence or good behaviour turned annoying.
> 
> I have gotten 1 good answer, 2 bad ones, and 1 case of annoying behaviour
> so far.

by the lack of
http://www.catb.org/~esr/faqs/smart-questions.html#beprecise in your
inital mail it's simply mpossible that you got any good answer which
didn't origin in a crystal ball

> man. 4. nov. 2019, 17:16 skrev Carl Zwanzig :
> 
>> On 11/4/2019 8:01 AM, Nicolas George wrote:
>>> Morten W. Petersen (12019-11-04):
 I want to keep the video, the moving pictures.
 How detailed is not decided.
>>
>>> Then decide. Nobody can do it for you, and there is no answer without
>>> that information.
>>
>> You also haven't told us about the original- resolution, frame rate,
>> encoding/compression/etc. All of them are information; you need to decide
>> what info can be thrown away.
>>
>> Resolution
>> Frame rate
>> Color encoding
>> Compression/encoding
>> Audio bit rate & compression
>> (others)

___
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] Reducing video file size

2019-11-04 Thread Carl Zwanzig

On 11/4/2019 8:22 AM, Morten W. Petersen wrote:

You are unable to understand what I ask for, and send an email 2 minutes
after I replied to Nicholas who gave a similar answer, when his lack of
intelligence or good behaviour turned annoying.


a) email is not synchronous and replies overlap.

b) we are "unable to understand" because you haven't stated a question that 
can be answered- you kind of asked the question "how can I make my car go 
faster" without even telling us the make/model of the car.



I have gotten 1 good answer, 2 bad ones, and 1 case of annoying behaviour
so far.


Welcome to the ffmpeg-user mailing list; the technical content is usually 
quite good, the wording can be a bit rough.



And you've already been asked not to "top-post" on this list; continuing to 
do that suggests that you're not interested in actually engaging with the list.


(in a top-posted reply)
On 11/4/2019 8:36 AM, Morten W. Petersen wrote:
> Let me ask in a different way, how can I encode a video to the smallest
> possible size, while still discerning some movement?

set the resolution to 1x1 and the frame rate to 1 per second; that'll be a 
really small file but completely useless. What's the minimum resolution you 
can tolerate? What's the minimum frame-rate that won't lose information. 
Maybe you need to only save the parts with detectable motion and discard the 
rest.




z!
___
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] Reducing video file size

2019-11-04 Thread Noeck
As others pointed out, this very much depends on what you want to
achieve (besides a small file size). But I try to offer a starting point
for you to try and find your own compromise of size and quality.

Usually, I would use a resolution of 1920x1080 (HD), but 1280x720 might
be an option to reduce the size. A frame rate of 25 frames per second
could be enough. But with typical codecs you will not get half the file
size by using half the frame rate. So 720p and 25 fps could be a
starting point. What is more important to you: a high resolution or a
smoothly moving image?

Then the vp9 codec (libvpx-vp9) and opus audio does a good job regarding
bitrate and a high CRF value reduces file size. Just try 32 and have a
look if you can tolerate the quality reduction and file size.

And only as a last resort go below a 480 resolution and 25 fps.
Audio bitrate is typically much smaller than video and there is not a
log to gain here. But with the opus codec you can go as low as 64kbit/s
if need be.

Of course there are many more ways to reach a small file size. The
numbers above are in the ball park of what could be reasonable for a
small web-quality video.

Best,
Daniel


> Resolution
> Frame rate
> Color encoding
> Compression/encoding
> Audio bit rate & compression
> (others)
___
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] Reducing video file size

2019-11-04 Thread Morten W. Petersen
Which codec gives the lowest size?

Let me ask in a different way, how can I encode a video to the smallest
possible size, while still discerning some movement?

Regards,

Morten

man. 4. nov. 2019, 17:29 skrev Moritz Barsnick :

> On Mon, Nov 04, 2019 at 17:14:07 +0100, Morten W. Petersen wrote:
> > I find your feedback annoying. Please stop.
>
> You asked for feedback, please don't tell anyone to stop. ;-)
>
> Honestly, you are asking about basics of video encoding in general, not
> about ffmpeg. There are much better places to read up on this.
>
> This is why your input is too hazy:
>
> We might tell you that you can use a more efficient codec, such as
> HEVC. You might come back and tell us "my device can't play that" or
> "encoding takes way too long".
>
> We might tell you to reduce resolution. You might come back and tell us
> "but all the details are gone".
>
> We might tell you to reduce the bitrate. You might come back and tell us
> "but the quality is really horrible".
>
> You need to be more precise in what you want to achieve (and perhaps
> why).
>
> Cheers,
> Moritz
> ___
> 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".
___
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] Reducing video file size

2019-11-04 Thread Morten W. Petersen
You are unable to understand what I ask for, and send an email 2 minutes
after I replied to Nicholas who gave a similar answer, when his lack of
intelligence or good behaviour turned annoying.

I have gotten 1 good answer, 2 bad ones, and 1 case of annoying behaviour
so far.

-Morten

man. 4. nov. 2019, 17:16 skrev Carl Zwanzig :

> On 11/4/2019 8:01 AM, Nicolas George wrote:
> > Morten W. Petersen (12019-11-04):
> >> I want to keep the video, the moving pictures.
> >> How detailed is not decided.
>
> > Then decide. Nobody can do it for you, and there is no answer without
> > that information.
>
> You also haven't told us about the original- resolution, frame rate,
> encoding/compression/etc. All of them are information; you need to decide
> what info can be thrown away.
>
> Resolution
> Frame rate
> Color encoding
> Compression/encoding
> Audio bit rate & compression
> (others)
>
> Later,
>
> z!
>
> ___
> 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".
___
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] Reducing video file size

2019-11-04 Thread Moritz Barsnick
On Mon, Nov 04, 2019 at 17:14:07 +0100, Morten W. Petersen wrote:
> I find your feedback annoying. Please stop.

You asked for feedback, please don't tell anyone to stop. ;-)

Honestly, you are asking about basics of video encoding in general, not
about ffmpeg. There are much better places to read up on this.

This is why your input is too hazy:

We might tell you that you can use a more efficient codec, such as
HEVC. You might come back and tell us "my device can't play that" or
"encoding takes way too long".

We might tell you to reduce resolution. You might come back and tell us
"but all the details are gone".

We might tell you to reduce the bitrate. You might come back and tell us
"but the quality is really horrible".

You need to be more precise in what you want to achieve (and perhaps
why).

Cheers,
Moritz
___
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] Transcode with the some properties

2019-11-04 Thread Moritz Barsnick
Hi Boris,

On Mon, Nov 04, 2019 at 10:29:10 +0100, Boris wrote:
> Hello,
> I want to transcode video with exactly the same properties of the input
> video in the output video.
> I use the transcoding.cc code. In the static int open_output_file(const
> char *filename) function, I set  encoder parameters like this :

This list (ffmpeg-users) is primarily for the use of the command line
tool. For assistance with programming with the libav* libraries, please
refer to the mailing list libav-user:
https://ffmpeg.org/mailman/listinfo/libav-user

Also please note that your code was wrapped in a fashion making it hard
to read:

http://ffmpeg.org/pipermail/ffmpeg-user/2019-November/045902.html

You may want to avoid line breaks in your mailer, or attach a text file instead.

> But when I run exiftool on output  video and on input video, some values
> like video duration, encoder, bit rate,  are differente.
> Can someone tells me how can I do to keep the same parameters (metada) of
> the input video in the output video, please?

What are you exactly trying to achieve? If you want *exactly* the same
characteristics, you should probably just copy the stream (and the
metadata) instead of re-encoding.

Duration and bitrate are not metadata.

The encoder (metadata) will be different, because it is a different
encoder. ;-) You can manipulate the metadata though.

If you correctly determine the source's bitrate, you should be able to
set it for the encoding, and depending on the encoder, you may achieve
the exact same rate.

But the input stream may have more characteristics, such as:
- VBR,
- GOP size, or even
- placement of I-frames,
- use of B-frames
and so on. Which of these do you want to duplicate, which not? And why?

If you specify your actual needs more precisely, it may be easier to
come up with a recipe to fulfill them. On the other list, of course.
;-)

Cheers,
Moritz
___
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] Reducing video file size

2019-11-04 Thread Morten W. Petersen
I find your feedback annoying. Please stop.

man. 4. nov. 2019, 17:01 skrev Nicolas George :

> Morten W. Petersen (12019-11-04):
> > I want to keep the video, the moving pictures.
> >
> > How detailed is not decided.
>
> Then decide. Nobody can do it for you, and there is no answer without
> that information.
>
> > man. 4. nov. 2019, 16:22 skrev Nicolas George :
>
> Top-posting is forbidden on this list; do not do it again if you want
> help; look it up if needed.
>
> Regards,
>
> --
>   Nicolas George
> ___
> 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".
___
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] Reducing video file size

2019-11-04 Thread Carl Zwanzig

On 11/4/2019 8:01 AM, Nicolas George wrote:

Morten W. Petersen (12019-11-04):

I want to keep the video, the moving pictures.
How detailed is not decided.



Then decide. Nobody can do it for you, and there is no answer without
that information.


You also haven't told us about the original- resolution, frame rate, 
encoding/compression/etc. All of them are information; you need to decide 
what info can be thrown away.


Resolution
Frame rate
Color encoding
Compression/encoding
Audio bit rate & compression
(others)

Later,

z!

___
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] Reducing video file size

2019-11-04 Thread Nicolas George
Morten W. Petersen (12019-11-04):
> I want to keep the video, the moving pictures.
> 
> How detailed is not decided.

Then decide. Nobody can do it for you, and there is no answer without
that information.

> man. 4. nov. 2019, 16:22 skrev Nicolas George :

Top-posting is forbidden on this list; do not do it again if you want
help; look it up if needed.

Regards,

-- 
  Nicolas George


signature.asc
Description: PGP signature
___
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] Reducing video file size

2019-11-04 Thread Morten W. Petersen
I want to keep the video, the moving pictures.

How detailed is not decided.

Regards,

Morten

man. 4. nov. 2019, 16:22 skrev Nicolas George :

> Morten W. Petersen (12019-11-04):
> > I'm wondering what the options are for reducing video size.
> >
> > Encoding in black and white / low color depth, reducing the resolution,
> > removing audio etc. are all options I can consider using.
>
> Remove the audio and the video streams completely, the size of the file
> will be 0, you cannot beat that.
>
> Seriously, if you do not say what you want to keep in the video, this is
> the best answer.
>
> Regards,
>
> --
>   Nicolas George
> ___
> 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".
___
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] Reducing video file size

2019-11-04 Thread Michael Shaffer
Reduce the frame rate.

On Mon, Nov 4, 2019 at 10:05 AM Morten W. Petersen 
wrote:

> Hi.
>
> I'm wondering what the options are for reducing video size.
>
> Encoding in black and white / low color depth, reducing the resolution,
> removing audio etc. are all options I can consider using.
>
> Regards,
>
> Morten
> ___
> 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".
___
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] Reducing video file size

2019-11-04 Thread Nicolas George
Morten W. Petersen (12019-11-04):
> I'm wondering what the options are for reducing video size.
> 
> Encoding in black and white / low color depth, reducing the resolution,
> removing audio etc. are all options I can consider using.

Remove the audio and the video streams completely, the size of the file
will be 0, you cannot beat that.

Seriously, if you do not say what you want to keep in the video, this is
the best answer.

Regards,

-- 
  Nicolas George


signature.asc
Description: PGP signature
___
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".

[FFmpeg-user] Reducing video file size

2019-11-04 Thread Morten W. Petersen
Hi.

I'm wondering what the options are for reducing video size.

Encoding in black and white / low color depth, reducing the resolution,
removing audio etc. are all options I can consider using.

Regards,

Morten
___
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".

[FFmpeg-user] Transcode with the some properties

2019-11-04 Thread Boris
Hello,
I want to transcode video with exactly the same properties of the input
video in the output video.
I use the transcoding.cc code. In the static int open_output_file(const
char *filename) function, I set  encoder parameters like this :

if (dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO)
{
enc_ctx->height = dec_ctx->height;
enc_ctx->width = dec_ctx->width;
enc_ctx->sample_aspect_ratio =
dec_ctx->sample_aspect_ratio;

enc_ctx->global_quality=dec_ctx->global_quality;
enc_ctx->gop_size=dec_ctx->gop_size;
enc_ctx->bit_rate=dec_ctx->bit_rate;
enc_ctx->time_base=dec_ctx->time_base;
enc_ctx->delay=dec_ctx->delay;

//**
enc_ctx->rc_max_rate=dec_ctx->rc_max_rate;
enc_ctx->rc_min_rate=dec_ctx->rc_min_rate;
/* take first format from list of supported
formats */
if (encoder->pix_fmts)
{
enc_ctx->pix_fmt =
encoder->pix_fmts[0];
}
else
{
enc_ctx->pix_fmt = dec_ctx->pix_fmt;
}
// video time_base can be set to whatever
is handy and supported by encoder
// enc_ctx->time_base =
av_inv_q(dec_ctx->framerate);
}
else
{
enc_ctx->sample_rate = dec_ctx->sample_rate;
enc_ctx->channel_layout =
dec_ctx->channel_layout;
enc_ctx->channels =
av_get_channel_layout_nb_channels(enc_ctx->channel_layout);
/* take first format from list of supported
formats */
enc_ctx->sample_fmt =
encoder->sample_fmts[0];
enc_ctx->time_base = (AVRational){1,
enc_ctx->sample_rate};
}
/* Third parameter can be used to pass settings to
encoder */
ret = avcodec_open2(enc_ctx, encoder, NULL);
if (ret < 0)
{
av_log(NULL, AV_LOG_ERROR, "Cannot open
video encoder for stream #%u\n", i);
return ret;
}
ret =
avcodec_parameters_from_context(out_stream->codecpar, enc_ctx);
if (ret < 0)
{
av_log(NULL, AV_LOG_ERROR, "Failed to copy
encoder parameters to output stream #%u\n", i);
return ret;
}
if (ofmt_ctx->oformat->flags & AVFMT_GLOBALHEADER)
enc_ctx->flags |=
AV_CODEC_FLAG_GLOBAL_HEADER;

out_stream->time_base = enc_ctx->time_base;


But when I run exiftool on output  video and on input video, some values
like video duration, encoder, bit rate,  are differente.
Can someone tells me how can I do to keep the same parameters (metada) of
the input video in the output video, please?

The entire open_output_file function is the following :

static int open_output_file(const char *filename)
{
 AVStream *out_stream;
AVStream *in_stream;
AVCodecContext *dec_ctx, *enc_ctx;
AVCodec *encoder;
int ret;
unsigned int i;
ofmt_ctx = NULL;
avformat_alloc_output_context2(_ctx, NULL, NULL, filename);
if (!ofmt_ctx)
{
av_log(NULL, AV_LOG_ERROR, "Could not create output
context\n");
return AVERROR_UNKNOWN;
}

for (i = 0; i < ifmt_ctx->nb_streams; i++)
{
out_stream = avformat_new_stream(ofmt_ctx, NULL);
if (!out_stream)
{
av_log(NULL, AV_LOG_ERROR, "Failed allocating
output stream\n");
return AVERROR_UNKNOWN;
}

in_stream = ifmt_ctx->streams[i];
dec_ctx = stream_ctx[i].dec_ctx;

if (dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO ||
dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO)
{
//AVCodecID codec_id = dec_ctx->codec_type ==
AVMEDIA_TYPE_VIDEO ? AV_CODEC_ID_MPEG4:dec_ctx->codec_id;
/* in this example, we choose transcoding to same
codec */
//encoder = dec_ctx->codec_type ==
AVMEDIA_TYPE_VIDEO ?