Blog posts

laptop not switching on?

Story of the day:

laptop not switching on? 😦 Don’t worry, there are some possible tweaks you could do before going to vendor support.

Problem faced: Unable to turn on my laptop (Zbook HP, Ubuntu) even with charging.

Solution (aka Magic):
It is brand new laptop. The only thing that did is, I ran very computationally expensive job (video related) yesterday. This was consuming around 700% of CPU.
Boom, today in the morning I had no idea why I was unable to turn the laptop on (the only reason I could think is because of heavy task). I checked the power cable condition, laptop shows it is getting charged. Guess what, I did what you would do (Google search). I got below (good) link for solution.

The link suggested several solutions. I tried all, worked the last one: Drain the computer of electricity. But, I did not have to go through all the steps. I just disconnected the adapter and pressed the power button for 10 to 15 seconds. Boom, I suddenly saw the power button light on. But still It was unable to boot. I then connected charger again and then turned the laptop on. Worked like charm.

Electricity is clogged. By disconnecting the adapter, you can decrease the amount of residual electrical charge. So, the electricity is now flowing freely and the laptop is good to power on 🙂


The Notorious MEME Culture

Memes. The social media accelerated the impact of Memes on many individuals especially Teens and early 20’s. When asked, people tell different opinions about the stereotypes in these Memes. While many people suppose them as absurd in the sense of racism and sexism, some admire the humor depicted by the Meme creator. Some popular Memes..

Yes, what one person can think of something funny can be offensive to others. Seems  very hard problem to solve (NP Hard? :D). But, as of my opinion, quantifying the impact of Memes on people is really important. Social network analysis researchers should show the downsides and usefulness of this infamous culture. Perhaps, there must be a measure which shows the offensiveness or positive impact of a Meme based on which it can be published on social media or not.


Library path issue while compiling some applications on Ubuntu

If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following:

  - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/'


export LD_RUN_PATH=/usr/local/lib
export LD_LIBRARY_PATH=/usr/local/lib/


Ffmpeg Commands for video processing

1. Crop specific portion of video using ffmpeg
ffmpeg -i input.mp4 -filter:v "crop=1080:560:0:650" -c:a copy out.avi
2. Extract individual frames from a video using ffmpeg
ffmpeg -i input.mp4 -vf fps=60 out%d.png
3. Cut specific portion of video using ffmpeg
ffmpeg -ss 24 -i input.mp4 -t 25 -c:a copy out.avi
4. Calculate PSNR/SSIM from input video and reference video using ffmpeg
ffmpeg -i input.mp4 -i rf.mp4 -strict -2 -filter_complex "psnr" "output.mp4"
5. Change the resolution of the video using ffmpeg
ffmpeg -i input.avi -vf scale=320:240 output.avi
6. Concatenate videos using ffmpeg
ffmpeg -i "concat:input1.avi|input2.avi|input3.avi" -c:a copy output.avi
7. Generate video with only black frames, using ffmpeg
ffmpeg -t 60 -s qcif -f rawvideo -pix_fmt rgb24 -r 25 -i /dev/zero dummy.mp4
8. Insert few black frames to an input video using ffmpeg
ffmpeg -i input.mp4 -f lavfi -i "color=c=black:s=1080x1920:r=25" -filter_complex "[0:v] setpts=PTS-STARTPTS [main]; [1:v] trim=end=10,setpts=PTS-STARTPTS [pre]; [pre][main] concat=n=2:v=1:a=0 [out]" -map "[out]" -vcodec mpeg2video -maxrate 30000k -b:v 30000k output.mp4
9. Split a video into multiple segments at key frames using ffmpeg
ffmpeg -i input.mp4 -f segment -vcodec copy -reset_timestamps 1 -map 0 output%d.mp4
10. Split a video into multiple segments of equal in length or approximately equal
ffmpeg -i input.mp4 -c copy -map 0 -segment_time 8 -f segment output%03d.mp4
11. Filter a video to get duplicate frames in a video using ffmpeg
ffmpeg -i input.mp4 -vf mpdecimate -loglevel debug -f null -
12. Generate a video by removing duplicate frames from input video using ffmpeg
ffmpeg -i input.mp4 -vf mpdecimate,setpts=N/FRAME_RATE/TB out.mp4