play videos side by side MELT - mlt

I am having issues in playing videos side by side. Can someone help me?
I am observing for my MELT sequence 1 video is scaled properly, but other is cropped.
Please suggest solution. Here is my melt command.
melt A_David_Beckham.mp4 in=0 out=650 \
-track -blank 49 C_KindleTouch.mp4 in=0 out=650 \
-transition composite start=0/0:960x1080 end=0/0:960x1080 distort=1 a_track=1 b_track=0 \
-transition composite start=960/0:960x1080 end=960/0:960x1080 distort=1 a_track=0 b_track=1 \
-transition mix:-1 in=50 out=650 a_track=0 b_track=1
A_Backham is scaled properly starting 50th frame, but C_KindleTouch.mp4 is cropped.
Both videos are HD videos and having length > 650 frames.

You need to have a Blank track running through in order to achieve this feat.
Here is MELT command to play 2 videos below in parallel audio of 2nd video will play. Switch tracks in order to switch audio.
melt colour:black out=650 \
-track A_David_Beckham.mp4 in=0 out=650 \
-track C_KindleTouch.mp4 in=0 out=650 \
-transition composite start=0/0:960x1080 end=0/0:960x1080 distort=1 a_track=0 b_track=1 \
-transition composite start=960/0:960x1080 end=960/0:960x1080 distort=1 a_track=0 b_track=2
In case you need to implement a Credit Squeeze.. Here is a way...
(Movie channels typically has requirement to squeeze In End Credits on Left and Start Playing next movie on right)
time melt colour:black out=599 \
-track C_KindleTouch.mp4 in=0 out=299 C_KindleTouch.mp4 in=300 out=349 -attach volume:0.1 C_KindleTouch.mp4 in=350 out=599 \
-track -blank 49 B_Samsung.mp4 in=0 out=599 \
-transition composite start=0/0:1920x1080 end=0/0:960x1080 distort=1 a_track=0 b_track=1 in=50 out=99 \
-transition composite start=1920/0:960x1080 end=960/0:960x1080 distort=1 a_track=0 b_track=2 in=50 out=99 \
-transition mix:-1 in=50 out=99 a_track=0 b_track=2 \
-transition composite start=0/0:960x1080 end=0/0:960x1080 distort=1 a_track=0 b_track=1 in=100 out=299 \
-transition composite start=960/0:960x1080 end=960/0:960x1080 distort=1 a_track=0 b_track=2 in=100 out=299 \
-transition composite start=0/0:960x1080 end=-960/0:960x1080 distort=1 a_track=0 b_track=1 in=300 out=349 \
-transition composite start=960/0:960x1080 end=0/0:1920x1080 distort=1 a_track=0 b_track=2 in=300 out=349 \
-transition mix:-1 in=300 out=349 a_track=0 b_track=2 \
-consumer avformat:output-squeeze_nd_back_final_v6.ts vcodec=nvenc_h264 vb=5000k acodec=aac ab=256k mlt_image_format=yuv420p
This is how effect is working
Play Black or Blank screen on Track 0, Play Video 1 (End Credits part) on Track 1 , play video 2 on track 2
Squeeze in Video 1 from full screen to left half as you bring in Video 2 in right half, mix it
Play Both videos in parallel for some duration
Squeeze Out Video1 and Expand Video 2 to full screen

Related

Problem while creating DataProc Cluster: Component ranger failed to activate post-hdfs

I am working in a Dataproc cluster setup to test all the features. I have created a cluster template and I've been using the creation command almost every day, but this week it stopped working. The error printed is:
ERROR: (gcloud.dataproc.clusters.create) Operation [projects/cluster_name/regions/us-central1/operations/number] failed: Failed to initialize node cluster_name-m: Component ranger failed to activate post-hdfs See output in: gs://cluster_bucket/google-cloud-dataproc-metainfo/number/cluster_name-m/dataproc-post-hdfs-startup-script_output.
When I see the output that the message print, the error found is:
<13>Mar 3 12:22:59 google-dataproc-startup[15744]: <13>Mar 3 12:22:59 post-hdfs-activate-component-ranger[15786]: ERROR: Error CREATEing SolrCore 'ranger_audits': Unable to create core [ranger_audits] Caused by: Java heap space
<13>Mar 3 12:22:59 google-dataproc-startup[15744]: <13>Mar 3 12:22:59 post-hdfs-activate-component-ranger[15786]:
<13>Mar 3 12:22:59 google-dataproc-startup[15744]: <13>Mar 3 12:22:59 post-hdfs-activate-component-ranger[15786]: + exit_code=1
<13>Mar 3 12:22:59 google-dataproc-startup[15744]: <13>Mar 3 12:22:59 post-hdfs-activate-component-ranger[15786]: + [[ 1 -ne 0 ]]
<13>Mar 3 12:22:59 google-dataproc-startup[15744]: <13>Mar 3 12:22:59 post-hdfs-activate-component-ranger[15786]: + echo 1
<13>Mar 3 12:22:59 google-dataproc-startup[15744]: <13>Mar 3 12:22:59 post-hdfs-activate-component-ranger[15786]: + log_and_fail ranger 'Component ranger failed to activate post-hdfs'
The creation command that I ran is:
gcloud dataproc clusters create cluster_name \
--bucket cluster_bucket \
--region us-central1 \
--subnet subnet_dataproc \
--zone us-central1-c \
--master-machine-type n1-standard-8 \
--master-boot-disk-size 500 \
--num-workers 2 \
--worker-machine-type n1-standard-8 \
--worker-boot-disk-size 1000 \
--image-version 2.0.29-debian10 \
--optional-components ZEPPELIN,RANGER,SOLR \
--autoscaling-policy=autoscale_rule \
--properties="dataproc:ranger.kms.key.uri=projects/gcp-project/locations/global/keyRings/kbs-dataproc-keyring/cryptoKeys/kbs-dataproc-key,dataproc:ranger.admin.password.uri=gs://cluster_bucket/kerberos-root-principal-password.encrypted,hive:hive.metastore.warehouse.dir=gs://cluster_bucket/user/hive/warehouse,dataproc:solr.gcs.path=gs://cluster_bucket/solr2,dataproc:ranger.cloud-sql.instance.connection.name=gcp-project:us-central1:ranger-metadata,dataproc:ranger.cloud-sql.root.password.uri=gs://cluster_bucket/ranger-root-mysql-password.encrypted" \
--kerberos-root-principal-password-uri=gs://cluster_bucket/kerberos-root-principal-password.encrypted \
--kerberos-kms-key=projects/gcp-project/locations/global/keyRings/kbs-dataproc-keyring/cryptoKeys/kbs-dataproc-key \
--project gcp-project \
--enable-component-gateway \
--initialization-actions gs://goog-dataproc-initialization-actions-us-central1/cloud-sql-proxy/cloud-sql-proxy.sh,gs://cluster_bucket/hue.sh,gs://goog-dataproc-initialization-actions-us-central1/livy/livy.sh,gs://goog-dataproc-initialization-actions-us-central1/sqoop/sqoop.sh \
--metadata livy-timeout-session='4h' \
--metadata "hive-metastore-instance=gcp-project:us-central1:hive-metastore" \
--metadata "kms-key-uri=projects/gcp-project/locations/global/keyRings/kbs-dataproc-keyring/cryptoKeys/kbs-dataproc-key" \
--metadata "db-admin-password-uri=gs://cluster_bucket/hive-root-mysql-password.encrypted" \
--metadata "db-hive-password-uri=gs://cluster_bucket/hive-mysql-password.encrypted" \
--scopes=default,sql-admin
I know that it's something related to Ranger/Solr setup, but I don't know how to increase this heap size without creating an alternative initialization script or creating a custom machine image. If you have any idea of how to solve this or need more information about my setup please let me know.
This could be a wrong character in a username in SSH configuration for the Dataproc Project, which the hadoop fs -mkdir -p command failed in the HDFS activation step during cluster creation.
You can follow these steps for a solution.
Create the cluster using command line within GCP.
Use the tag --metadata=block-project-ssh-keys=true \ below when
creating a cluster, even if metadata tags exist for other purposes
and still add this tag at the end.
You can see this example.
gcloud dataproc clusters create cluster_name \
--metadata=block-project-ssh-keys=true \
--bucket cluster_bucket \
--region us-central1 \
--subnet subnet_dataproc \
………..
This is not required as this feature is enabled by default:
--initialization-actions gs://goog-dataproc-initialization-actions-us-central1/cloud-sql-proxy/cloud-sql-proxy.sh,gs://cluster_bucket/hue.sh,gs://goog-dataproc-initialization-actions-us-central1/livy/livy.sh,gs://goog-dataproc-initialization-actions-us-central1/sqoop/sqoop.sh
\
In the cloud SQL for MySQL, enable the flag log_bin_trust_function_creators to ON. Setting this flag controls whether stored function creators can be trusted not to create stored functions that will cause unsafe events to be written to the binary log. You can reset the flag to OFF after cluster creation. Please try and let me know if you see issues.
Also, please share the error log for more details.

The Image Magic font does not apply

In my project, I draw a certificate using the shell, on the background image I put all 3 lines. I manage to apply different colors to them, font size, but I can't use different fonts.
shell.exec(
`convert ${certificateImage} -resize 800x600 \
-gravity south \
-fill blue -font Candice -pointsize 60 -annotate +0+190 '${certificateHeader}' \
-fill black -font Candice -pointsize 40 -annotate +0+190 '${certificateTxt}' \
-fill red -font SheerBeauty -pointsize 20 -annotate -100+40 '${nextCertNumber}' \
${thumbnailsFolder}/${certificateId}.png`,
{async: true},
() => log('thumbnail created successfully'),
);
What am I doing wrong? I would be grateful for any answer. I watched imagemagic, but so far nothing is working.

Converting PDF to PNG with same resolution - Imagemagick

I have 1000s of PDFs with multiple pages and each PDF has different resolution (based on scanners used to scan them). I want to convert each page of PDF to PNG to pass it to Tesseract for OCR. I used Imagemagick to convert to PNG but have to pass a fixed DPI for all images to get a good readable output. Is there a way I can convert each PDF by preserving the resolution of that PDF too?
For example, if 1.PDF has resolution 622 × 788 and 2.pdf has resolution 792 × 612, I want the exact conversion with same resoultion just a different format(PNG).
The command I am using right now is:
convert -monochrome -density 1200 input.pdf -resize 25% -monochrome -white-threshold 50% -black-threshold -50% output.png
Thanks,
pashah
Perhaps read the geometry of the first page, then resize all pages to match?
SIZE=$(identify -format '%g' input.pdf)
convert -monochrome \
-density 1200 \
-resize $SIZE \
-white-threshold 50% \
-black-threshold -50% \
-append \
output.png

How to convert .mov files to .mp4 (H264) using ffmpeg using windows .bat file?

I have a number of different video files (mov, avi, flv, mp4, 3gp, wmv) in a folder.
I need to use a batch file that will convert all mov, avi, wmv, 3gp files in the folder
Also I need to skip any flv, mp4 files
I have this command, but it gives error and generates 0 size files:
for %%F in (*.mov) do ffmpeg.exe -i "%%~fF" -vcodec copy -acodec copy "%%~dpF\%%~nF.mp4"
The above line just tries to process mov files. I get same result for avi files.
I want to keep the file name same. I get the file names correctly but it gives error:
ffmpeg version N-54691-g7f4a1fd Copyright (c) 2000-2013 the FFmpeg developers
built on Jul 12 2013 16:31:48 with gcc 4.7.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-
amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --
enable-libxvid --enable-zlib
libavutil 52. 39.100 / 52. 39.100
libavcodec 55. 18.102 / 55. 18.102
libavformat 55. 12.102 / 55. 12.102
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 80.101 / 3. 80.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, avi, from 'C:\musa\Challenge\FFMPEG\Test\file5.AVI':
Metadata:
encoder : OPTURA20
Duration: 00:00:10.01, start: 0.000000, bitrate: 1518 kb/s
Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj422p, 320x240, 14.99 fps,
14.99 tbr, 14.99 tbn, 14.99 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono, s16,
256 kb/s
[mp4 # 00000000024bc980] Tag [1][0][0][0]/0x00000001 incompatible with output co
dec id '65536' ([0][0][0][0])
Output #0, mp4, to 'C:\musa\Challenge\FFMPEG\Test\\file5.mp4':
Metadata:
encoder : OPTURA20
Stream #0:0: Video: mjpeg (l[0][0][0] / 0x006C), yuvj422p, 320x240, q=2-31,
14.99 fps, 90k tbn, 14.99 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono, 256 k
b/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Could not write header for output file #0 (incorrect codec parameters ?): Invali
d data found when processing input
PCM audio streams are not compatible with the MP4 container, look at the specs and your error message:
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono, s16, 256 kb/s [mp4 # 00000000024bc980] Tag [1][0][0][0]/0x00000001 incompatible with output codec id '65536' ([0][0][0][0])
Please note: the MP4 video container format and the H.264 video stream format are two different things. The MP4 video container may also 'contain' other video stream formats, eg. Xvid or even MJPEG.
The video stream is MJPEG, if you really want MP4/H264 on the output, you should replace the
-vcodec copy
by the -vcodec option to transcode your input video content
or add more complex stuff to detect when you can bypass the video stream and when a transcode is require.

Can't seek beyond downloaded data in some H.264 videos in Silverlight

The project I'm currently working on is using a Silverlight based player to stream wmv videos encoded through WME.
However we want to be able to move away from Silverlight in the future and to the video tag in HTML5, so we need to encode our videos to H.264 in an mp4 container.
Everything is fine except for on small problem, it's not possible to seek beyond what has been downloaded, at least not on lower quality encodes.
One of our test files is an HD wmv video, which we encode down to 2 Mbit, 1 Mbit and 0.5 Mbit using FFmpeg, and mp4box to reorder the moov atoms.
In both the 2 and 1 Mbit encodes the Silverlight MediaElement recognizes a seek beyond what's downloaded as we'd like it to, and requests video data and starts playing from the seek point.
However, with the 0.5 Mbit video that doesn't happen, and instead the video freezes while it keeps downloading the video normally.
Using a low-quality H.264 video from Youtube works, so I don't know if it's the parameters to FFmpeg that's the problem or something else.
Here's the encoding command-line:
ffmpeg -y -i fooHD.wmv -an -vcodec libx264 -vpre slow -level 41 -b 2000k -bufsize 20000k -maxrate 25000k -g 250 -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -flags2 +dct8x8+bpyramid -me_method umh -subq 7 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -bf 16 -b_strategy 1 -bidir_refine 1 -refs 6 -deblockalpha 0 -deblockbeta 0 -threads 0 -pass 1 -f rawvideo nul
ffmpeg -y -i fooHD.wmv -acodec libfaac -ar 44100 -ab 96k -vcodec libx264 -vpre slow -level 41 -b 2000k -bufsize 20000k -maxrate 25000k -g 250 -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -flags2 +dct8x8+bpyramid -me_method umh -subq 7 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -bf 16 -b_strategy 1 -bidir_refine 1 -refs 6 -deblockalpha 0 -deblockbeta 0 -threads 0 -pass 2 bar2000k.mp4
ffmpeg -y -i fooHD.wmv -acodec libfaac -ar 44100 -ab 96k -vcodec libx264 -vpre slow -level 41 -b 1000k -bufsize 20000k -maxrate 25000k -g 250 -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -flags2 +dct8x8+bpyramid -me_method umh -subq 7 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -bf 16 -b_strategy 1 -bidir_refine 1 -refs 6 -deblockalpha 0 -deblockbeta 0 -threads 0 -pass 2 bar1000k.mp4
ffmpeg -y -i fooHD.wmv -acodec libfaac -ar 44100 -ab 96k -vcodec libx264 -vpre slow -level 41 -b 500k -bufsize 20000k -maxrate 25000k -g 250 -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -flags2 +dct8x8+bpyramid -me_method umh -subq 7 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -bf 16 -b_strategy 1 -bidir_refine 1 -refs 6 -deblockalpha 0 -deblockbeta 0 -threads 0 -pass 2 bar500k.mp4
mp4box.exe -inter bar2000k.mp4
mp4box.exe -inter bar1000k.mp4
mp4box.exe -inter bar500k.mp4
fooHD.wmv is 2:17 long and running at 8 Mbit/s # 29.97 fps.
My throught immediately goes to an issue related to a lack of keyframes, but I see -g 250 for all your encoding settings. However based on some past issues with encoders getting fast and loose with I-frame settings at low bandwidth I still suggest reading back the I-frame/keyframe stats to see if your 500k file is not being encoded the way you asked.

Resources