I have Xubuntu 14.04. The camcorder I am using is the Sony CCD-TRV16 NTSC 180x Digital Zoom. I am using the Hauppauge 610 USB-Live 2 Analog Video Digitizer and Video Capture Device to convert 8mm tapes to mp4. I am using VLC to convert the videos.
I will be converting quite a few tapes. It would be nice to have my exact same VLC GUI settings I use in a command or script. Also the ability to cut off recording after a certain time period would be great. I do not care what program I use to convert these. This customer said they were able to successfully use ffmpeg. However, I am fine with using any program that works. Much thanks in advance!
Here is the output of ffmpeg -f v4l2 -i /dev/video0 -f alsa -i hw:2,0
.
Input #0, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 8535.656468, bitrate: 165722 kb/s
Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 720x480, 165722 kb/s, 29.97 fps, 29.97 tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, alsa, from 'hw:2,0':
Duration: N/A, start: 1450034548.361553, bitrate: 1536 kb/s
Stream #1:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
Best Answer
Preliminary Steps
Launch VLC with
vlc -vvv
. This turns on verbosity to2 (debug)
. This can also be seen in VLC GUI by going to Tools > Messages. Then follow the steps listed above in the screen shots to display the needed information for the command in the debug log. Then you can adjust the appropriate syntax by looking at the script below and online. You can also see the code and syntax by selecting Show more options. (The first screenshot in my question above.) However, this is only how I was able to create the cvlc command below. You may simply want to adjust the below script to your needs.Initially, I was unable to get the audio to work with the one RCA audio port on my camcorder. I fixed this by going to Tools > Preferences > All (radio button, bottom left). Then I went to Input / Codecs > Access modules > ALSA. I changed the Sample rate to 48000 Hz. After changing this setting you will be able to stream your video. The other sample rates were causing an error.
Go to Media > Open Capture Device. Select Video device name and Audio device name (note that in the screen shot above it is default because I was using the microphone port instead. Yours will be different if you're using the RCA connection on your Hauppauge device.) Select NTSC (or whatever format your video tapes are). Click Play. While playing, go to Tools > Codec Information. You will want to adjust the below script according to the information given there. I adjusted the frame rate to 29.97 and sample rate to 48000 Hz. in my script because of the information given there.
About the Script
a. You are prompted to input the filename and metadata. Files are set to save to ~/Videos.
b. VLC (cvlc)
--foreground
option allows you to hit 'ctrl c,' and it will stop only this portion of the script and continue to the next part. (Some videos I have are shorter.)vcodec
andacodec
are set set tompeg2
andmpga
. The Amazon product page for the Hauppauge 610 states that it encodes to MPEG-2.mux=ts
. Initially I was usingvcodec=h264
acodec=mpga
andmux=mp4
. However, there were audio sync issues and the sound would drop out at certain places in the video. Also see the mux= section here.samplerate=48000
for it to work.mux=ts
will create a large file. My two hour videos are 5-7 GB.c. FFmpeg compresses further with libx264 (from about 5 GB to about 1.5 GB) and adds in the metadata. There were additional handwritten notes about each 8mm tape and I wanted to include this additional information with the file. In the same command, FFmpeg moves left channel audio from only left to both left and right channels as a stream copy with no additional audio compression. My camcorder has only one RCA audio port. So this fixes the one speaker issue. Thanks to mondaugen for their answer on the one-channel audio issue.
d. Lastly, you are notified when the script finishes. For my personal script, I am actually using the following instead.
On my computer:
File contains:
<p style="font-size: 128px; color: green; font-family: sans; text-align: center; margin-top: 10%; font-weight: bold;">VIDEO FINISHED</p>
On my phone: You can install
gcalcli
to receive a notification on your phone via Google Calendar when the script completes. Below, the date and time for two minutes in the future is put into a variable. Then a calendar entry is created for that time. A reminder is set for the start of that event. Google Calendar needs a two minute buffer. (I tried one minute.) So, you would be notified two minutes after the encode finishes.End Product
The final result produces the larger .ts file and a further compressed .mp4.
CPU Usage
I have an AMD A8-6500B processor.
cvlc
runs at about 15% cpu usage. However,ffmpeg
was running at about 97%. Therefore, in my script (not in the one below), I added the-threads 3
option to keep CPU usage at an overall 75%. I am able to do this because my processor is quad core.