I'm trying to create a TC Burn-In that correctly displays the source video's TC.
My current FFMPEG filter line is:
-filter_complex "[0:1][0:2] amerge" -preset ultrafast -vf scale=960:540:in_range=tv:out_range=pc,"drawtext=\timecode='00\:00\:00\:00':timecode_rate=25:x=(w-tw)/2:y=h-(2*lh):fontcolor=white#1:fontsize=30:box=1:boxcolor=black#0.6" -c:v libx264 -pix_fmt yuv420p -crf 27 -c:a aac -ar 48000 -b:a 128k
This of course starts the Burn-In at 00:00:00:00, but I'd rather insert the file's TC (in this case, it starts at 10:00:00:00) -- data taken from MediaInfo:
Other #1
ID : 1-Material
Type : Time code
Format : MXF TC
Frame rate : 25.000 FPS
Time code of first frame : 10:00:00:00
Time code of last frame : 10:02:34:20
Time code settings : Material Package
Time code, stripped : Yes
Title : Timecode
Other #2
ID : 0-Source
Type : Time code
Format : MXF TC
Frame rate : 25.000 FPS
Time code of first frame : 10:00:00:00
Time code of last frame : 10:02:34:20
Time code settings : Source Package
Time code, stripped : Yes
Other #3
Type : Time code
Format : SMPTE TC
Muxing mode : SDTI
Frame rate : 25.000 FPS
Time code of first frame : 10:00:00:00
I have not found a way to make FFMPEG read the TC and use it for the Burn-In. Do any of you guys know how to accomplish this?
Thanks
Christian
Just in case anyone ever has the same issue: ffmpeg by itself is not able to read the file's TC and use it to burn in TC (as of January 2023).
There is a workflow tool for encoding that I use (FFAStrans -- it's free and it's awesome) that can achieve this: https://ffastrans.com/frm/forum/viewtopic.php?f=5&t=1442
Related
when i use
ffmpeg -i BabyShark.mp4 -c:v hevc_videotoolbox -b:v 6000k BabyShark1.mp4
it always returns an error like
[hevc_videotoolbox # 0x7fec79206e00] Error encoding frame: -12905
[hevc_videotoolbox # 0x7fec79206e00] popping: -542398533 Error
initializing output stream 0:0 -- Error while opening encoder for
output stream #0:0 - maybe incorrect parameters such as bit_rate,
rate, width or height [aac # 0x7fec79208a80] Qavg: 13693.864 [aac #
0x7fec79208a80] 2 frames left in the queue on closing Conversion
failed!
but
ffmpeg -i BabyShark1.mp4 -c:v h264_videotoolbox -b:v 6000k BabyShark2.mp4
works fine.
Other tutorials say that the above error is a problem of out-of-sync audio and video
But I changed a lot of videos, the error still appears, even the videos I recorded myself.
How can i fix it.
My computer model is MacBook Pro 2019
I want to use GPU to convert video to H265 encoding
Same problem with a computer using another M1 chip With GPU
I have some videos at 1080p 60fps.
These videos are with level=50 and my TV plays only videos up to level=41, so I want to convert my videos using ffmpeg and hardware acceleration.
I have a Windows 10 machine with ffmpeg and Geforce 2060, so I try run below command:
ffmpeg -i video.mp4 -vcodec h264_nvenc -preset slow -level 4.1 output.mp4
but I get this error:
[h264_nvenc # 000001dd43cd07c0] InitializeEncoder failed: invalid param (8): Invalid Level.
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
When I try to run the same command above using "-level 4.2" or above, the encode process works! But it is useless for me, because I really need "-level 4.1".
I noticed that if use libx264 instead of h264_nvenc, the encode process accepts "-level 4.1", but it take too long to complete (I want to enjoy hardware acceleration instead of CPU).
How can I force h264_nvenc to accept "level=4.1" ?
I am using FFMPEG with GPU h264_nvenc codec to upscale MPEG2 interlaced files.
h264_nvenc generate h264 with the store method: Separate fields (in mediaInfo) instead of the store method: Interleaved fields. These files with separate fields seems to be incompatible with tools like GVG Edius. How to change this store method?
with ffmpeg version N-92103-gebc3d04b8d Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 8.2.1 (GCC) 20180813
Command FFMPEG:
-ss 00:14:45 -hwaccel cuda -c:v mpeg2_cuvid -i "input.mpg" -t 00:00:10 -vf "scale=if(gt(dar\,1.6)\,1920\,1460):1080:flags=lanczos:interl=1" -c:v h264_nvenc -pix_fmt nv12 -flags +ilme+ildct -b:v 16M -maxrate:v 22M -bufsize:v 8M -profile:v high -level:v 4.1 -rc:v vbr -coder:v cabac -f mp4 -y "inputUpscaled_GPU.MP4"
mediainfo testUpscale_GPU.MP4:
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High#L4.1
Format settings : CABAC / 1 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference frames : 1 frame
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 10 s 0 ms
Bit rate mode : Variable
Bit rate : 17.8 Mb/s
Maximum bit rate : 22.0 Mb/s
Width : 1 460 pixels
Height : 1 080 pixels
Display aspect ratio : 4:3
Frame rate mode : Constant
Frame rate : 25.000 FPS
Original frame rate : 50.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Interlaced
Scan type, store method : Separated fields
Scan order : Top Field First
Bits/(Pixel*Frame) : 0.451
Stream size : 21.2 MiB (99%)
Codec configuration box : avcC
I try to encode video using hevc codec
./ffmpeg -i 1234.mp4 -vcodec hevc_videotoolbox -vb 1000k -acodec aac -ab 192k -sn 2.mp4
error:
[hevc_videotoolbox # 0x7fc681813a00] Error: cannot create compression session: -12908
[hevc_videotoolbox # 0x7fc681813a00] Try -allow_sw 1. The hardware encoder may be busy, or not supported.
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
i try change bitrate, width, height, error still exist
is it possible encode video on my macbook air 2015?
is videotoolbox can't use my old GPU and its possible on newest macbooks?
I have the same question recently, I found this when I was looking for answers:
Screenshot from this pdf: enter link description here
It's possible that old mac doesn't support HEVC hardware acceleration natively, I don't have a new mac to test if ffmpeg has anything related to it, maybe someone whose mac has 6th Gen CPU can help you address the problem.
Edit:
I tested following code on the latest 2018 mbp and it worked.
ffmpeg -i VIDEO_PATH -vcodec hevc_videotoolbox -tag:v hcv1 OUT_PATH
The size of the hevc_videotoolbox-encoded video#1 is smaller than the original test file(h264) but larger than libx265-encoded video#2 (using default parameters).
Unexpectedly, the quality of video#1 is much worse than that of the original, whereas video#2 seems untouched. Besides, hevc_videotoolbox doesn't support -crf option, so I'm still stick to libx265, even though it is really slow.
I'm having issues regarding the output video lenght when using the following code wich seems to work for everybody else.
On a input mp3 of 04:56 i get a 05:09 , the last part is only the image , no sound , for a longer mp3 input file i get more silent video at the end.
I'm ussing the "-shortest" option just before the output file as an argument , as suggested in other threads around stackoverflow/superuser.
ffmpeg -loop 1 -i image.jpg -i audio.mp3 -c:v libx264 -tune stillimage -c:a aac -strict experimental -b:a 192k -shortest out.mp4
I already changed the input file type - wav , and the image - png , jpg , same silent "overhead" at the end of the video.
I was using a extra argument "-framerate 2" that was causing the extra video length , going default with 25 frames/second outputs a video closer to the audio input file length(just 2-4 seconds extra of silence)