Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert a ImageClip in a CompositeVideoClip. How to add nil audio #669

Closed
harold-s opened this issue Nov 20, 2017 · 2 comments
Closed

Insert a ImageClip in a CompositeVideoClip. How to add nil audio #669

harold-s opened this issue Nov 20, 2017 · 2 comments

Comments

@harold-s
Copy link

Hello,

I'm using CompositeVideoClip to stitch a video clip and an image (which I want to display for 5 seconds)

I do something like :

video_clip = VideoFileClip(video)
image_clip =  ImageClip(image, duration=5).set_start(video_clip.duration)
CompositeVideoClip([video_clip,image_clip]).write_videofile(output_file, fps=30)

The stich works great (you can download it here : http://dl.free.fr/j41R2x8R5)

The only problem is that the video track then lasts 15 seconds (10 seconds of the video + 5 seconds of the image) and the audio track lasts 10 s and that makes the seek on VLC not work.

Any idea how I could make the audio track lasts the total length of the video (with ffmpeg anullsrc ?)

Here is the medianfo :

General
Complete name                            : /tmp/output_file.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 3.27 MiB
Duration                                 : 15 s 0 ms
Overall bit rate                         : 1 828 kb/s
Writing application                      : Lavf57.71.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4
Format settings, CABAC                   : Yes
Format settings, RefFrames               : 4 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 15 s 0 ms
Bit rate                                 : 1 736 kb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 30.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.028
Stream size                              : 3.10 MiB (95%)
Writing library                          : x264 core 148 r2795 aaa9aa8
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=25 / 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                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 3
Mode                                     : Joint stereo
Codec ID                                 : 6B
Duration                                 : 10 s 32 ms
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 44.1 kHz
Compression mode                         : Lossy
Stream size                              : 157 KiB (5%)
Default                                  : Yes
Alternate group                          : 1
@Zulko
Copy link
Owner

Zulko commented Nov 20, 2017

I haven't done that in a long time, but what happens is you just do that ?

final_clip.audio.duration = final_clip.duration

@harold-s
Copy link
Author

Wow that just worked ...

Thank you very much indeed !!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants