Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

8 votes
3 answers
3354 views
Convert video to exactly the same format as another video
Suppose I have two video files A and B. Now I want to convert A to the same format (i.e. same container, same audio and video codec), same bitrate, size etc. as B. Is there a way to do this automatically (i.e. without extracting the information manually and giving it manually as input parameters) us...
Suppose I have two video files A and B. Now I want to convert A to the same format (i.e. same container, same audio and video codec), same bitrate, size etc. as B. Is there a way to do this automatically (i.e. without extracting the information manually and giving it manually as input parameters) using a command line tool (or even a GUI tool)?
student (18865 rep)
Nov 26, 2014, 07:12 PM • Last activity: Apr 28, 2025, 07:08 AM
1 votes
1 answers
1105 views
Using mencoder to record a video
I'm trying to use `mencoder` to record a video. The following command was taken from an [online tutorial](https://wiki.archlinux.org/index.php/Webcam_setup#MPlayer): mencoder tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0:forceaudio:adevice=/dev/dsp -ovc lavc -oac mp3lame -lameopts cb...
I'm trying to use mencoder to record a video. The following command was taken from an [online tutorial](https://wiki.archlinux.org/index.php/Webcam_setup#MPlayer) : mencoder tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0:forceaudio:adevice=/dev/dsp -ovc lavc -oac mp3lame -lameopts cbr:br=64:mode=3 -o filename.avi The output is as follows: MEncoder SVN-r37379 (C) 2000-2015 MPlayer Team 210 audio & 441 video codecs success: format: 9 data: 0x0 - 0x0 TV file format detected. Selected driver: v4l2 name: Video 4 Linux 2 input author: Martin Olschewski comment: first try, more to come ;-) v4l2: your device driver does not support VIDIOC_G_STD ioctl, VIDIOC_G_PARM was used instead. Selected device: UVC Camera (046d:0825) Capabilities: video capture streaming supported norms: inputs: 0 = Camera 1; Current input: 0 Current format: YUYV tv.c: norm_from_string(pal): Bogus norm parameter, setting default. v4l2: ioctl enum norm failed: Inappropriate ioctl for device Error: Cannot set norm! Selected input hasn't got a tuner! Unable to open '/dev/dsp': No such file or directory Unable to open '/dev/dsp': No such file or directory Unable to open '/dev/dsp': No such file or directory v4l2: ioctl set mute failed: Invalid argument v4l2: 0 frames successfully processed, 0 frames dropped. ============ Sorry, this file format is not recognized/supported ============= === If this file is an AVI, ASF or MPEG stream, please contact the author! === Cannot open demuxer. Exiting... user@ArchBox:~/Dropbox$ mencoder tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0:forceaudio:ade[15838:17998:0117/045341:ERROR:cert_verify_proc_nss.cc(922)] CERT_PKIXVerifyCert for api.tldr.io failed err=-8181 How do I address these errors?
George (1899 rep)
Jan 17, 2016, 09:57 AM • Last activity: Aug 24, 2021, 08:30 AM
3 votes
1 answers
2641 views
How to display an image with mplayer?
**How can I display a `jpg` image with `mplayer` for an infinite amount of time?** Wen opening an image with `mplayer`, the image is displayed for about 0.1s and then `mplayer` is leaving: mplayer image.png PS: the ultimate goal is to send a picture to /dev/fb0 which can be done with the mplayer opt...
**How can I display a jpg image with mplayer for an infinite amount of time?** Wen opening an image with mplayer, the image is displayed for about 0.1s and then mplayer is leaving: mplayer image.png PS: the ultimate goal is to send a picture to /dev/fb0 which can be done with the mplayer option -fbdev2 /dev/fb0
user123456 (5258 rep)
Dec 15, 2016, 02:41 PM • Last activity: Mar 7, 2021, 07:26 PM
1 votes
0 answers
1280 views
Command line VOB to AVI/MP4 with good quality and deinterlace
I have some VOB files, grabbed from DVDs. I need to make AVI/MP4 files for uploading online. The original resolution is 720p and I want 720p, but need to scale as the pixels are not square (720x480 to I want to do it with the command line; whether it's mencoder or ffmpeg (or even vlc if I can master...
I have some VOB files, grabbed from DVDs. I need to make AVI/MP4 files for uploading online. The original resolution is 720p and I want 720p, but need to scale as the pixels are not square (720x480 to I want to do it with the command line; whether it's mencoder or ffmpeg (or even vlc if I can master its command line) is immaterial. But despite all googling I'm getting dodgy quality, notably, bad deinterlacing. Moreover some mencoder options I find are no longer valid anyway. (I want MPEG4/lavc encoding; let's not bother with x264). I would appreciate examples that give good quality deinterlaced MP4/AVI from VOB files. Which tool is used is immaterial as long as it's commonly available under Linux. EDIT: here is the output of ffmpeg -analyzeduration 100M -probesize 100M -i file.VOB . The subtitle track, however, is not needed.
`
Input #0, mpeg, from 'deathscene_from14_40.VOB':
  Duration: 00:35:51.24, start: 1068.184978, bitrate: 7986 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, smpte170m, top first), 720x480 [SAR 8:9 DAR 4:3], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0xa0]: Audio: pcm_dvd, 48000 Hz, stereo, s16, 1536 kb/s
    Stream #0:2[0x1bf]: Data: dvd_nav_packet
    Stream #0:3[0x20]: Subtitle: dvd_subtitle
`
Mikhail Ramendik (538 rep)
Dec 24, 2019, 03:03 PM • Last activity: Dec 24, 2019, 09:24 PM
0 votes
1 answers
1743 views
H.264/MPEG-4 from PNG frames: how to, and how to tune compression
I often create digital animations by preparing all the frames in .png format (with minimal compression), that I need to convert to video format for upload to websites such as reddit, instagram, gfycat. I know very little of all the different standards of compression, and these websites aren't very c...
I often create digital animations by preparing all the frames in .png format (with minimal compression), that I need to convert to video format for upload to websites such as reddit, instagram, gfycat. I know very little of all the different standards of compression, and these websites aren't very clear as to what format they accept, but I've found a recipe that usually works for me, and that creates files that get accepted by these websites: # step 1 mencoder mf://frame*.png -mf w=$WIDTH:h=$HEIGHT:fps=$FPS:type=png \ -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=16000:keyint=15:mbd=2:trell \ -oac copy -o step1.avi # step 2 mencoder step1.avi -o step2.mp4 -of lavf -lavfopts format=mp4 -ovc x264 -sws 9 \ -x264encopts nocabac:level_idc=30:bframes=0:bitrate=2048:threads=auto:turbo=1:global_header:threads=auto:subq=5:frameref=6:partitions=all:trellis=1:chroma_me:me=umh However I'm not completely sure what it does*, therefore I'm not able to: - make it a single instruction - tune the compression rate. Indeed, I'd often prefer a less compressed result. **What route can I follow to go from PNG frames to** a web-friendly video file (that I believe is a **H.264/MPEG-4 MP4**) that gives me the ability to tune compression? ---- \* for instance: this is an example frame enter image description here (note: honestly it seems to me that it looks much worse when watching it in VLC than when taking a snapshot through the VLC tool - this makes it very difficult to make the question understandable and the results comparable) Even if in *step 1* I have specified $WIDTH and $HEIGHT to match the ones of the original image, it has apparently changed both, and not preserved the aspect ratio. There is also more blur to the final image, that might be just an effect of such resize. ---- **edit:** see the actual system screenshot of the mplayer window below (would be the same with VLC). The tile grouts are very blurred compared to both the PNG source and the VLC "internal" screenshot feature enter image description here Detail: enter image description here
Nicola Sap (111 rep)
Jan 7, 2018, 06:06 PM • Last activity: Jan 9, 2018, 09:21 AM
28 votes
4 answers
60959 views
Convert a video to a fixed screen size by cropping and resizing
I've tried to figure this out myself, but the myriad of options just baffles me. I want to use ideally either `ffmpeg` or `mencoder` (or something else, but those two I know I have working) to convert any incoming video to a fixed screen size. If the video is wider or too short for it, then centre c...
I've tried to figure this out myself, but the myriad of options just baffles me. I want to use ideally either ffmpeg or mencoder (or something else, but those two I know I have working) to convert any incoming video to a fixed screen size. If the video is wider or too short for it, then centre crop the video. If it's then not the right size, the resize up or down to make it exactly the fixed screen size. The exact final thing I need is 720x480 in a XVid AVI with an MP3 audio track. I've found lots of pages showing how to resize to a maximum resolution, but I need the video to be exactly that resolution (with extra parts cropped off, no black bars). Can anyone tell me the command line to run - or at least get me some/most of the way there? If it needs to be multiple command lines (run X to get the resolution, do this calculation and then run Y with the output of that calculation) I can script that.
Andy Jeffries (283 rep)
Mar 16, 2015, 08:54 AM • Last activity: Mar 10, 2017, 06:19 PM
2 votes
1 answers
5782 views
What is the format name to have a MP4 video as output in ffmpeg?
The following command ffmpeg -f alsa -ac 2 -i plughw:0,0 -f video4linux2 -s vga -i /dev/video0 -f ogg - > video.mp4 Does not produce a `.mp4` video. I want to replace `-f ogg` with `-f ` where ` ` is the right format to generate a video in `.mp4`. To make thinks clear, I want to have: # file video.m...
The following command ffmpeg -f alsa -ac 2 -i plughw:0,0 -f video4linux2 -s vga -i /dev/video0 -f ogg - > video.mp4 Does not produce a .mp4 video. I want to replace -f ogg with -f where ` is the right format to generate a video in .mp4`. To make thinks clear, I want to have: # file video.mp4 video.mp4: ISO Media, MP4 Base Media v1 [IS0 14496-12:2003] ----------------------------------------------------- PS: I want to use pipe, since it is used for other pipe operations
j1088099.mvrht.com. (3193 rep)
Dec 12, 2016, 09:07 PM • Last activity: Dec 12, 2016, 09:59 PM
1 votes
0 answers
54 views
Linux mencoder and green frames
I like to rip my vhs on mpeg format I use a vcr svhs and this mencoder line mencoder -tv driver=v4l2:alsa:adevice=hw.0,0:amode=1:audiorate=32000:forceaudio:immediatemode=0:freq=189.250:device=/dev/video0:input=3:norm=PAL:width=720:height=576:outfmt=yuy2 tv:// -oac lavc -ovc lavc -of mpeg -mpegopts f...
I like to rip my vhs on mpeg format I use a vcr svhs and this mencoder line mencoder -tv driver=v4l2:alsa:adevice=hw.0,0:amode=1:audiorate=32000:forceaudio:immediatemode=0:freq=189.250:device=/dev/video0:input=3:norm=PAL:width=720:height=576:outfmt=yuy2 tv:// -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf pp=lb/ha/va/dr,hqdn3d,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1500:vrc_maxrate=8000:vbitrate=7000:keyint=15:acodec=mp2:abitrate=192:aspect=4/3 -o video.mpg The rip is ok,audio in sync but i see very annoyng green frames and actors seems aliens. There is a way to avoid green frames? enter image description here
elbarna (13690 rep)
Dec 7, 2016, 01:21 AM
4 votes
0 answers
5526 views
How to re-encode file A.mp4 with the same settings as B.mp4?
I have a MP4 file with AAC audio and H264 video, let's call it `B.mp4`. I also have file `A.mp4` with the same picture resolution, but: - different FPS - possibly different audio/video bitrate - different codecs I would like to re-encode file `A.mp4` with the exact same settings as `B.mp4` because a...
I have a MP4 file with AAC audio and H264 video, let's call it B.mp4. I also have file A.mp4 with the same picture resolution, but: - different FPS - possibly different audio/video bitrate - different codecs I would like to re-encode file A.mp4 with the exact same settings as B.mp4 because after that I want to use mkvmerge to mux them together, so they must match. How can I do this? Is there a way to "copy" settings from B.mp4 to A.mp4? Up to now I am able to see some codec information using mediainfo or mplayer -identify, but I don't know how to pass everything to ffmpeg (preferably) or mencoder. The command I am looking for should copy every setting (codec, bitrate, frame rate, ...) from one video to the re-encoded version of the other one. Even better if I can specify starting and ending keyframes on video A.mp4.
Andrea Lazzarotto (526 rep)
Jan 24, 2016, 11:54 PM • Last activity: Jan 25, 2016, 05:59 PM
3 votes
1 answers
81 views
Why does mencoder output still images if I try to encode them under 3 FPS, while mencoder outputs dynamic images if I output them at 3 FPS or over?
If I try... mencoder mf://@NetSWLW12MA.txt -mf w=800:h=600:fps=1.5:type=png -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o NetSWLW12MA2.avi I just get a bunch of still images of the first frame. if I try... mencoder mf://@NetSWLW12MA.txt -mf w=800:h=600:fps=4:type=png -ovc lavc -lavcopts...
If I try... mencoder mf://@NetSWLW12MA.txt -mf w=800:h=600:fps=1.5:type=png -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o NetSWLW12MA2.avi I just get a bunch of still images of the first frame. if I try... mencoder mf://@NetSWLW12MA.txt -mf w=800:h=600:fps=4:type=png -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o NetSWLW12MA2.avi then I get mencoder to robustly play all the images. (there are 145 separate image frames contained in the txt file). Is there a way to put all 145 images as separate images in the mencoder file when I encode it at 1 FPS?
InquilineKea (6432 rep)
Jul 21, 2014, 09:33 PM • Last activity: Jul 24, 2014, 10:00 AM
2 votes
0 answers
1719 views
Rotating a video (ubuntu 12.04)
I have a video, shot on my android phone, which I want to rotate 90 degrees clockwise for computer viewing. Here's what I expect should work: ffmpeg -i infile.mp4 -vf "transpose=1" -an -vcodec mpeg4 outfile.mp4 except that it gives me: Error while opening encoder for output stream #0.0 - maybe incor...
I have a video, shot on my android phone, which I want to rotate 90 degrees clockwise for computer viewing. Here's what I expect should work: ffmpeg -i infile.mp4 -vf "transpose=1" -an -vcodec mpeg4 outfile.mp4 except that it gives me: Error while opening encoder for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height The command ffmpeg -codec does produce a long list which includes DEVSDT mpeg4 MPEG-4 part 2 Then I experimented with ffmpeg -vf "transpose=1″ -qscale=2 -i infile.mp4 outfile.mp4 but this seems to be an unfinished command, as all I get is a ">" symbol in my terminal. I've also tried: mencoder -fps 30000/1001 -ofps 30000/1001 -ovc lavc -vf rotate=1 -oac pcm infile.mp4 -o outfile.mp4 which does work, but gives a very poor output - far worse than the input. I can certainly view the video in the correct orientation: mplayer -vo xv -vf rotate=1 infile.mp4 but I have as yet not found a way to write the rotated video to a file. I have no experience at all with video coding, so any advice would be most welcome!
Alasdair (281 rep)
Jun 26, 2013, 07:29 AM • Last activity: Nov 10, 2013, 12:55 PM
3 votes
1 answers
5896 views
Convert images into avi with Raspberry Pi
I'm following this page: [Creating Timelapse Videos With The Raspberry Pi Camera][1]. But every time I try to make the video, I get this error: ![ss of error][2] *original: https://i.sstatic.net/ApIJ0.png* Specifically this command from the output above: $ avconv -r 10 -i pic_%04d.png -r 10 -vcodec...
I'm following this page: Creating Timelapse Videos With The Raspberry Pi Camera . But every time I try to make the video, I get this error: ss of error *original: https://i.sstatic.net/ApIJ0.png* Specifically this command from the output above: $ avconv -r 10 -i pic_%04d.png -r 10 -vcodec libx264 -crf 20 -g 15 \ -vf crop=2592:1458,scale=1280:720 timelapse.mp4 ... ... Output #0, mp4, to 'timelapse.mp4': Output file #0 does not contain any stream Also when using mencoder, following this page: 6.8. Encoding from multiple input image files (JPEG, PNG, TGA, etc.) : ss of error *original: https://i.sstatic.net/svNLx.png* Can someone please help?
Coolcrab (133 rep)
Nov 2, 2013, 08:38 PM • Last activity: Nov 2, 2013, 11:30 PM
1 votes
1 answers
1616 views
Merging flv files causes a massive size increase
I have 3 flv files which I wish to merge. I used the answer in this post: https://unix.stackexchange.com/questions/45870/merge-multiple-flv-files which suggested this option: mencoder -forceidx -ovc copy -oac pcm -o output.flv input1.flv input2.flv It seems to have worked except that the merged file...
I have 3 flv files which I wish to merge. I used the answer in this post: https://unix.stackexchange.com/questions/45870/merge-multiple-flv-files which suggested this option: mencoder -forceidx -ovc copy -oac pcm -o output.flv input1.flv input2.flv It seems to have worked except that the merged file is 400meg in size whereas the original 3 files were about 33meg each. Is this expected? Is there a way to join the 3 files without the massive increase in size?
Carl (11 rep)
Jan 13, 2013, 06:08 PM • Last activity: Jan 21, 2013, 03:04 PM
4 votes
1 answers
1691 views
How do I use MEncoder to encode all png files (in the current directory) as an avi file in order of date modification?
So I want MEncoder to encode all png files as an avi file from the earliest date modified to the last date modified, and I'd like each frame to be spaced out by 3 seconds.
So I want MEncoder to encode all png files as an avi file from the earliest date modified to the last date modified, and I'd like each frame to be spaced out by 3 seconds.
InquilineKea (6432 rep)
Dec 11, 2012, 07:25 PM • Last activity: Dec 11, 2012, 09:04 PM
1 votes
1 answers
1848 views
Converting dvd to MKV videos, anything wrong here?
I'm converting DVD media to a MKV format video with mencoder: `mencoder dvd://4 -o output.mkv -oac mp3lame -ovc x264 -x264encopts crf=20:8x8dct:frameref=4:bframes=3:b_pyramid=normal:weight_b` But the output from `file output.mkv` indicate it's AVI format ? `RIFF (little-endian) data, AVI, 720 x 576,...
I'm converting DVD media to a MKV format video with mencoder: mencoder dvd://4 -o output.mkv -oac mp3lame -ovc x264 -x264encopts crf=20:8x8dct:frameref=4:bframes=3:b_pyramid=normal:weight_b But the output from file output.mkv indicate it's AVI format ? RIFF (little-endian) data, AVI, 720 x 576, 25.00 fps, video: H.264 X.264 or H.264, audio: MPEG-1 Layer 3 (stereo, 48000 Hz)
daisy (55777 rep)
Jul 3, 2012, 11:13 AM • Last activity: Jul 3, 2012, 12:01 PM
2 votes
1 answers
2619 views
Terminate script using zenity progress bar
(GNOME2, Ubuntu 10.04 LTS) I've made a nautilus script, so that if I have a directory full of various codecs, then I just need to right click in that folder -> Scripts -> THISSCRIPT.txt, then presto, it recursively converts all the video files (identified by video mimetype) to x.264 codec with 128 K...
(GNOME2, Ubuntu 10.04 LTS) I've made a nautilus script, so that if I have a directory full of various codecs, then I just need to right click in that folder -> Scripts -> THISSCRIPT.txt, then presto, it recursively converts all the video files (identified by video mimetype) to x.264 codec with 128 Kbit mp3 to avi. So that they will have small size+good quality. This works, great! **QUESTION**: If I press "Cancel" on the Zenity progress bar, then the mencoder doesn't terminates.. How can I do this? I mean I need that If I press "Cancel" on the Zenity progress bar, it would terminate mencoder. How to do this? #!/bin/bash which mencoder > /dev/null 2>&1; if [[ $? -ne 0 ]]; then echo -e '\nerror, no mencoder package detected'; exit 1; fi which zenity > /dev/null 2>&1; if [[ $? -ne 0 ]]; then echo -e '\nerror, no zenity package detected'; exit 1; fi HOWMANYLEFT=0 find . -type f | xargs -I {} file --mime-type {} | fgrep "video/" | rev | awk 'BEGIN {FS="/oediv :"} { print $NF}' | rev | while read ONELINE do if file "$ONELINE" | egrep -qvi "x.264|h.264" then echo $ONELINE fi done | sed 's/^.\///' | tee /tmp/vid-conv-tmp.txt | while read ONELINE do HOWMANY=wc -l /tmp/vid-conv-tmp.txt | cut -d " " -f1 mencoder "$ONELINE" -o "OK-$ONELINE.avi" -ovc x264 -x264encopts bitrate=750 nr=2000 -oac mp3lame -lameopts cbr:br=128 > /dev/null 2>&1 HOWMANYLEFT=expr $HOWMANYLEFT + 1 echo "scale=10;($HOWMANYLEFT / $HOWMANY) * 100" | bc | cut -d "." -f1 done | zenity --progress --text="Processing files ..." --auto-close --percentage=0
gasko peter (5634 rep)
Jul 1, 2012, 11:17 PM • Last activity: Jul 2, 2012, 01:24 PM
7 votes
2 answers
15457 views
Mencoder with same quality output
I like `mencoder` for converting video files because it shows me how much time is remaining to the end of the conversion (in opposite to `ffmpeg`). mencoder file.wmv -ofps 23.976 -ovc lavc -oac copy -o file.avi The problem is that the resulting file is not the same quality as the input file. With `f...
I like mencoder for converting video files because it shows me how much time is remaining to the end of the conversion (in opposite to ffmpeg). mencoder file.wmv -ofps 23.976 -ovc lavc -oac copy -o file.avi The problem is that the resulting file is not the same quality as the input file. With ffmpeg there is sameq option. Is there similar option for mencoder to achieve the same quality? Is this only my feeling or is mencoder faster than ffmpeg when I will achieve the same quality? thank you
xralf (15189 rep)
Nov 13, 2011, 04:11 PM • Last activity: Mar 25, 2012, 01:11 AM
4 votes
1 answers
4723 views
Fix error in mp3 file
I have an `mp3` file that plays OK on computer but there is a problem to play it on `mp3 player`. ffmpeg shows this: $ ffmpeg -i file.mp3 [mp3 @ 0x8de72a0] Invalid size in frame , skipping the rest of tag. [mp3 @ 0x8de72a0] max_analyze_duration reached [mp3 @ 0x8de72a0] Estimating duration from bitr...
I have an mp3 file that plays OK on computer but there is a problem to play it on mp3 player. ffmpeg shows this: $ ffmpeg -i file.mp3 [mp3 @ 0x8de72a0] Invalid size in frame , skipping the rest of tag. [mp3 @ 0x8de72a0] max_analyze_duration reached [mp3 @ 0x8de72a0] Estimating duration from bitrate, this may be inaccurate Input #0, mp3, from 'file.mp3': Duration: 00:27:44.50, start: 0.000000, bitrate: 55 kb/s Stream #0.0: Audio: mp3, 22050 Hz, mono, s16, 56 kb/s Can I fix this problem with some utility? like ffmpeg or mencoder?
xralf (15189 rep)
Jan 4, 2012, 02:13 PM • Last activity: Jan 4, 2012, 06:24 PM
Showing page 1 of 18 total questions