[FFmpeg-user] Slicing a 4K video to images and then encoding them back using the same codec

Liran Sharoni Liran.Sharoni at sandisk.com
Thu Oct 15 18:14:40 CEST 2015


Hi Kieran,

My agenda is imprinting each frame with its number while still keeping the same video timestamps, encoding properties etc. so it would be virtually identical ( except the frame numbers)
I took into consideration your suggestion to use the drawtext filter
I tried :
C:\Users\23547\Desktop>"C:\FFMPG\ffmpeg.exe" -i "C:\4kplayback\Encodertest\HONEY.mp4" -vf drawtext="fontsize=2000:fontfile="C:\\\\\4kplayback\\\\\Encodertest\\\\\SouthernAire_Personal_Use_Only.ttf": box=1: text=expr:%{n}"  "C:\Users\23547\Desktop\4kplayback\Encodertest\Honey_test.mp4"

But the video created is not the same at all ( I can see this using media info) :The container format profile is not Base Media/Version 2 , the codec ID is not mp42, some data is not even displayed here like Overall bit rate mode and the list goes on.

* also I couldn’t use the drawtext filter to display the numbers from 1 ( only from 0 , tried using expr but it only showed me "n+1}" on the video)

Thanks for the advice, I hope you have good answers

For the original:
General
Complete name                            : C:\ 4kplayback\Encodertest\HONEY.mp4
Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42
File size                                : 604 MiB
Duration                                 : 3mn 47s
Overall bit rate mode                    : Variable
Overall bit rate                         : 22.3 Mbps
Encoded date                             : UTC 2012-09-17 15:25:33
Tagged date                              : UTC 2012-09-17 15:25:33
gsst                                     : 0
gstd                                     : 227601
gssd                                     : B3EE74BC4MM1350869204851145
gshh                                     : o-o---preferred---sn-gqn-vu2l---v17---lscache5.c.youtube.com

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High at L5.1
Format settings, CABAC                   : No
Format settings, ReFrames                : 1 frame
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 3mn 47s
Bit rate                                 : 22.1 Mbps
Maximum bit rate                         : 55.8 Mbps
Width                                    : 4 096 pixels
Height                                   : 2 304 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 24.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.098
Stream size                              : 599 MiB (99%)
Encoded date                             : UTC 1970-01-01 00:00:00
Tagged date                              : UTC 2012-09-17 15:25:34

Audio
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : 40
Duration                                 : 3mn 47s
Bit rate mode                            : Variable
Bit rate                                 : 192 Kbps
Maximum bit rate                         : 202 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 44.1 KHz
Compression mode                         : Lossy
Stream size                              : 5.21 MiB (1%)
Title                                    : IsoMedia File Produced by Google, 5-11-2011
Encoded date                             : UTC 2012-09-17 15:25:34
Tagged date                              : UTC 2012-09-17 15:25:34

And the output :

General
Complete name                            : C \4kplayback\Encodertest\Honey_test.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom
File size                                : 4.70 MiB
Duration                                 : 2s 167ms
Overall bit rate                         : 18.2 Mbps
Writing application                      : Lavf57.4.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High at L5.1
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 2s 167ms
Bit rate                                 : 18.1 Mbps
Width                                    : 4 096 pixels
Height                                   : 2 304 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 24.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.080
Stream size                              : 4.67 MiB (99%)
Writing library                          : x264 core 148 r2638 7599210
Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00

Audio
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : 40
Duration                                 : 2s 10ms
Duration_LastFrame                       : -10ms
Bit rate mode                            : Constant
Bit rate                                 : 129 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 44.1 KHz
Compression mode                         : Lossy
Stream size                              : 31.6 KiB (1%)

-----Original Message-----
From: ffmpeg-user [mailto:ffmpeg-user-bounces at ffmpeg.org] On Behalf Of Kieran O Leary
Sent: Wednesday, October 14, 2015 10:26 PM
To: FFmpeg user questions
Subject: Re: [FFmpeg-user] Slicing a 4K video to images and then encoding them back using the same codec

On 14 Oct 2015 18:50, "Liran Sharoni" <Liran.Sharoni at sandisk.com> wrote:
>
> Hi,
> I am trying to slice a 4K video losslessly to frames , draw numbers on
every frame(used matlab) and then recombine all the frames to create a nearly identical video.
> Is it possible in ffmpeg , and how?
> Thanks,
> Liran
>
>

Do you have to turn your video into an image sequence for a specific reason? You should be able to use the drawtext filter to add text to your image. You should choose a lossless codec such as ffv1 in order to preserve the quality of your original video, minus your superimposed image.

It might help if you post whatever attempts you've tried thus far with the full uncut console output.

Best,

Kieran.
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

________________________________

PLEASE NOTE: The information contained in this electronic mail message is intended only for the use of the designated recipient(s) named above. If the reader of this message is not the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify the sender by telephone or e-mail (as shown above) immediately and destroy any and all copies of this message in your possession (whether hard copies or electronically stored copies).



More information about the ffmpeg-user mailing list