/media/bill/HOWELL_BASE/System_maintenance/video/avconv/0_avconv notes.txt www.BillHowell.ca 26Sep2016 initial example, see "$d_bin""video production/videoCam plus audioRecoder mix.sh" *********************** 25Oct2017 ogv codecs, players https://techterms.com/definition/codec Audio and video files are compressed with a certain codec when they are saved and then decompressed by the codec when they are played back. Common codecs include MPEG and AVI for video files and WAV and AIFF for audio files. +-----+ $ avconv -codecs +---+ DEV.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_crystalhd h264_vdpau ) (encoders: libx264 libx264rgb ) DEV.L. mpeg4 MPEG-4 part 2 (decoders: mpeg4 mpeg4_crystalhd mpeg4_vdpau ) (encoders: mpeg4 libxvid ) +-----+ ogv players see : https://fileinfo.com/extension/ogv *********************** 18Dec2016 avconv async option My current impression is that async is to "morph" the audio timing to fit the exact video times, but that this is NOT what I want to do!! Also, as per comemnts below, the audio & video must already have timestamps in the file data, which is probably not the case for my audio (captured via James Pemberton's computer) https://www.libav.org/avconv.html#asyncts "avconv Documentation" great info!! http://superuser.com/questions/681263/ffmpeg-avconv-async-is-not-working-unsync-audio#681358 ffmpeg/avconv async is not working - unsync audio ptQa, edited Nov 28 '13 at 10:15, answered Nov 27 '13 at 15:38 Option -async help only if you have timestamps in your audio and video streams. I doubt you have it. Tha's why you don't see any difference in output. So probably your problem is that video and audio have different duration and start time. If it's so you should trim your audio or video stream (it depends whether your audio or video is longer). Update: Ffmpeg does not have any information about which audio package is should be displayed at the same time as some video frame. You should use some container that have timestampts in streams like mpegts, not wav. shareimprove this answer ******************** 12Dec2016 blend audio & video streams http://tuxdiary.com/2014/08/29/extract-merge-audio-video-tracks-avconv/ 1. Check the audio track information from the original file $ avconv -i original.mp4 ... Stream #0.1(und): Audio: aac, 48000 Hz, stereo, fltp, 95 kb/s ... >> 1. avconv -i "/media/bill/VIDEO_PRODN/ACM Facility Safety presentation 01Sep2016/Howell - Big Data, Deep Learning, Safety nosound.ogv" Duration: 00:35:12.79, start 0.000000, bitraqte 848 kb/s Stream #0:0: Data: none Stream #0:1: Video: theora, yuv420p, 1248x672 [SAR 1:1 DAR 13:7], 24 tbr, 24 tbn, 24 tbc Metadata: RECORDMYDESKTP : 0.3.8.1 2. Copy audio and video tracks to the same directory and merge them. Let’s say that you need to add some delay to the audio as well. The following command does it all $ avconv -i video.mkv -itsoffset 00:00:00.2 -i audio96.aac -acodec copy -vcodec copy merged.mkv >> avcon -i "/media/bill/VIDEO_PRODN/ACM Facility Safety presentation 01Sep2016/161211 Howell - full ACM audio.wma" Metadata: WMFSDKNeeded : 0.0.0.0000 DeviceConformanceTemplate: L1 WMFSDKVersion : 12.0.7601.17514 IsVBR : 0 Duration: 00:34:57.41, start: 0.000000, bitrate: 96 kb/s Stream #0:0(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz, stereo, fltp, 96 kb/s **************** 27Sep2016 avconv - try "-pass n (n = 1 to 3) for better quality? Try : cmd := link 'avconv ' ' -ss ' (string sec_from_time ts_start) ' -t ' (string t_snip) ' -i "' dir_media_in fname_video_in '" ' ' -pass 3 ' ' -f vob "' dir_video_out snip_fileName '" ' ; Error : Cannot read file 'ffmpeg2pass-0.log': No such file or directory >> Add -loglevel 3 to see if that works The program ran, but no output? Try again >> Nothing again. Leave this for a rainy day **************** 26Sep2016 18:34 for video snipping only (can't screen capture) try avconv instead of recoredmydesktop IMPORTANT!! - recordmydesktop ONLY works on Toshiba : pulseaudio needs the IEC958 audio card, which is on the Toshiba! flag_rmd := l ; % rmd = recordmydesktop, as opposed to avconv. This should be set in each 0_vidExtract DVD data file ; This was put as global just before "Kasparov" Oops - no avconv http://www.larshaendler.com/2016/04/13/install-avconv-on-linux-mint-or-ubuntu/ sudo apt install libav-tools >> done vidEx -> ERRORS : 1. [mpeg2video @ 0x9efec60] Invalid frame dimensions 0x0. 2. Codec AVoption bufsize (set ratecontrol buffer size (in bits)) specified for input file #0 (/media/bill/Lexar/Kasparov vid/VTS_01_2.VOB) is not a decoding option. Can't "man avconv" Search "Linux Mint and avconv and options" http://www.tecmint.com/avconv-command-examples/ 11 ‘Avconv’ Commands to Record, Convert and Extract Videos & Audios from Linux Terminal by Hanny Helal | Published: November 26, 2014 | Last Updated: January 2, 2015 To extract the audio only from any video file, and to output it to another file, you may run the following command. $ avconv -i Michael-Jackson-You-Rock-My-World-HD.mp4 -vn -f wav sound.wav -vn is an option that we use to remove the video from the multimedia file. -f wav is the format we want our output file to use it, you can switch to “mp3” or “webm” if you want. sound.wav is the name of the output file. $ avconv --help In snip_record I removed ' -bufsize 1835k ' from the following cmd := link 'avconv -timelimit ' (string t_snip) ' -bufsize 1835k ' ' -i "' dir_media_in fname_video_in '" ' ' -ss ' (string sec_from_time ts_start) ' -q 12 -strict experimental "' dir_video_out snip_fileName '" ' ; I don't know what to do about error : 1. [mpeg2video @ 0x9efec60] Invalid frame dimensions 0x0. just loaddefs & try again >> It processed input and produced 6Mb file output (should be ~15Mb?), but it can't be run? videos player ERROR : This file contains no playable streams. vlc player : no action or message... Now change : cmd := link 'avconv -timelimit ' (string t_snip) ' -i "' dir_media_in fname_video_in '" ' ' -ss ' (string sec_from_time ts_start) ' -q 12 -strict experimental "' dir_video_out snip_fileName '" ' ; to : cmd := link 'avconv -t ' (string t_snip) ' -i "' dir_media_in fname_video_in '" ' ' -ss ' (string sec_from_time ts_start) ' -f ogg "' dir_video_out snip_fileName '" ' ; >> Works, but SHITTY video resolution, choppy motion Now try : cmd := link 'avconv -t ' (string t_snip) ' -i "' dir_media_in fname_video_in '" ' ' -ss ' (string sec_from_time ts_start) ' -s 625x300 ' ' -f ogg "' dir_video_out snip_fileName '" ' ; size = WxH -> full size 1251x600, half size 625x600 much smoother flow, but still a bit chppy & video resolution sucks! Now try : cmd := link 'avconv -t ' (string t_snip) ' -i "' dir_media_in fname_video_in '" ' ' -ss ' (string sec_from_time ts_start) ' -s 1251x600 ' ' -f mp4 "' dir_video_out snip_fileName '" ' ; No output file - premature termination.. Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height Now try : cmd := link 'avconv -t ' (string t_snip) ' -i "' dir_media_in fname_video_in '" ' ' -ss ' (string sec_from_time ts_start) ' -s 1250x600 ' ' -f vob "' dir_video_out snip_fileName '" ' ; Good enough - could make it better later with 2 snip records, nothing output? even given "wait_recordmydesktop t_snip ; " snip_record '00:08:19' '00:08:44' 'Kasparov takes a chance' ; snip_record '00:13:26' '00:13:36' 'Something not in the rules' ; Now try : wait_recordmydesktop IS OP secs_duration { NONLOCAL t_factor_recordmydesktop_processing ; secs_wait := (secs_duration * t_factor_recordmydesktop_processing) ; host (link 'sleep ' (string secs_wait) 's') ; } cmd := link 'avconv -t ' (string t_snip) ' -i "' dir_media_in fname_video_in '" ' ' -ss ' (string sec_from_time ts_start) ' -s 1250x600 ' ' -f mpeg "' dir_video_out snip_fileName '" ' ; STRANGE - now I can't get ANY output???? This sort of works (quality OK, but not great) : cmd := link 'avconv ' ' -ss ' (string sec_from_time ts_start) ' -t ' (string t_snip) ' -i "' dir_media_in fname_video_in '" ' ' -f vob "' dir_video_out snip_fileName '" ' ; There is a serious time offset from what is desired... will have to fudge around to get start & end right enddoc