Avidemux Forum

Avidemux => Unix-Like (Linux/Bsd/...) => Topic started by: iacoposk8 on April 10, 2013, 09:18:11 AM

Title: join video via terminal
Post by: iacoposk8 on April 10, 2013, 09:18:11 AM
I'm creating a bash script that runs through my subfolders in a directory where there are two files inside 000.MPG and 001.MPG, I would like to join them with a command of avidemux and encode them to MPEG-PS.
how can I?
Title: Re: join video via terminal
Post by: Jan Gruuthuse on April 10, 2013, 10:26:40 AM
perhaps you can find the required info here: Scripting: Avidemux functions (http://www.avidemux.org/admWiki/doku.php?id=using:scripting#avidemux_functions)
Title: Re: join video via terminal
Post by: iacoposk8 on April 10, 2013, 12:23:48 PM
I managed to create a script that join me the two files.
two questions:
when I run the script I get the popup that asks me if I want to index your files and mpg, and I manually say yes. the script can not do it for me?
I want to export the file to MPEG-PS I tried with:
app.saveDVD ("file.mpg");
and also with
app.Codec ("MPEG-PS");
app.save ("file.mpg");
but he says that the functions Codec and saveDVD do not exist ... how can I?
Title: Re: join video via terminal
Post by: Jan Gruuthuse on April 10, 2013, 01:00:21 PM
are you using avidemux3_cli? try with avidemux3_qt4, just replace avidemux3_cli by avidemux3_qt4 in the script? see if that works?
dvd is very strict, probably you would need to re-encode both video parts up to the spec? check with mediainfo (http://mediainfo.sourceforge.net/) what this is for .vob (from a non protected dvd) regio 0 not 1 or 2, ...
Title: Re: join video via terminal
Post by: iacoposk8 on April 10, 2013, 01:45:09 PM
avidemux3_cli avidemux3_qt4 and I can not install them, I may have an old version of ubuntu? it seems as if there were.
I wrote:
avidemux2_cli --audio-codec copy --video-codec MPEG-PS --output-format mpg --load 000.mpg --append 001.mpg --save video.mpg
I do not know if MPEG-PS I wrote it in the right place.
because i read

Complete name                            : video.mpg
Format                                   : AVI
Format/Info                              : Audio Video Interleave
...
...


another thing: I run this command generates requests to which I have to manually answer with yes (y) or not (n).
I would make sure you get him to say more but automatically, unless I manually type in
Title: Re: join video via terminal
Post by: Jan Gruuthuse on April 10, 2013, 01:58:36 PM
perhaps more like?
avidemux2_cli --load 000.mpg --append 001.mpg --audio-codec copy --video-codec MPEG-PS --saveDVD video.vob
Looks like youre using a version below 2.6. What is your currently used ubuntu version? And is it 32-bit or 64-bit?
I'm not that familiar with scripting. The settings I use are saved in a tiny project file, and then loaded from command line in script.
For Linux/Unixes using Bash shell similar script with --run something.py
Combination of command-line and JS scripting (http://www.avidemux.org/admWiki/doku.php?id=tutorial:batch_processing#combination_of_command-line_and_js_scripting)
Very basic sample: 2.6 audio track switching in job.py (http://www.avidemux.org/smf/index.php/topic,10499.0.html)
You could use yes command (http://askubuntu.com/questions/71566/what-is-the-yes-command)?
Title: Re: join video via terminal
Post by: iacoposk8 on April 10, 2013, 02:35:12 PM
I have ubuntu 12.04 32-bit.

if you fail to have MPEG-PS is better, but it is not essential, I can do without ... I'm more interested to understand how to use the command "yes", I wrote this but I do not know if it's right:

avidemux2_cli --load 000.mpg --append 001.mpg --output format mpg --save output.mpg | yes

but don't work

ps: avidemux2_cli --load 000.mpg --append 001.mpg --audio-codec copy --video-codec MPEG-PS --saveDVD video.vob I do not export anything

Thank you very much aid you're giving me and your patience :)
Title: Re: join video via terminal
Post by: Jan Gruuthuse on April 10, 2013, 04:28:43 PM
upgrade to 2.6.3 can be found here: http://avidemux.org/nightly/precise32/
Hehe lucky, found my previous posting about yes command: Problem in running scripts from cli (http://www.avidemux.org/smf/index.php?topic=10403.0)
Title: Re: join video via terminal
Post by: mit on April 10, 2013, 04:52:23 PM
I think, this will work:
avidemux2_cli  --load 000.mpg --append 001.mpg --audio-codec copy  --save video.vob  --output-format PS --video-codec mpeg2enc
You also can try  --video-codec copy
Title: Re: join video via terminal
Post by: iacoposk8 on April 10, 2013, 08:26:33 PM
the yes command works perfectly :)

Quote from: mit on April 10, 2013, 04:52:23 PM
I think, this will work:
avidemux2_cli  --load 000.mpg --append 001.mpg --audio-codec copy  --save video.vob  --output-format PS --video-codec mpeg2enc
You also can try  --video-codec copy
yet the format is avi: (

General
Complete name                            : video.MPG
Format                                   : AVI
Format/Info                              : Audio Video Interleave
File size                                : 1.47 GiB
Duration                                 : 1h 38mn
Overall bit rate                         : 2 144 Kbps

Video
ID                                       : 0
Format                                   : MPEG Video
Format version                           : Version 2
Format profile                           : Main@Main
Format settings, BVOP                    : Yes
Format settings, Matrix                  : Custom
Codec ID                                 : MPEG
Codec ID/Info                            : Chromatic MPEG 1 Video I Frame
Duration                                 : 1h 38mn
Bit rate                                 : 2 014 Kbps
Maximum bit rate                         : 10 000 Kbps
Width                                    : 720 pixels
Height                                   : 576 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 25.000 fps
Standard                                 : PAL
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Interlaced
Scan order                               : Top Field First
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.194
Stream size                              : 1.38 GiB (94%)

Audio
ID                                       : 1
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 2
Codec ID                                 : 50
Duration                                 : 1h 32mn
Bit rate mode                            : Constant
Bit rate                                 : 128 Kbps
Channel(s)                               : 2 channels
Sampling rate                            : 48.0 KHz
Compression mode                         : Lossy
Stream size                              : 84.8 MiB (6%)
Alignment                                : Aligned on interleaves
Interleave, duration                     : 42 ms (1.06 video frame)


mezzo@mezzo-HP-Pro-3135-Microtower-PC:~/Scrivania/tv/2013-01-19.23.20.00-DMAX-285$ mediainfo video.vob
General
Complete name                            : video.vob
Format                                   : AVI
Format/Info                              : Audio Video Interleave
File size                                : 1.47 GiB
Duration                                 : 1h 38mn
Overall bit rate                         : 2 144 Kbps

Video
ID                                       : 0
Format                                   : MPEG Video
Format version                           : Version 2
Format profile                           : Main@Main
Format settings, BVOP                    : Yes
Format settings, Matrix                  : Custom
Codec ID                                 : MPEG
Codec ID/Info                            : Chromatic MPEG 1 Video I Frame
Duration                                 : 1h 38mn
Bit rate                                 : 2 014 Kbps
Maximum bit rate                         : 10 000 Kbps
Width                                    : 720 pixels
Height                                   : 576 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 25.000 fps
Standard                                 : PAL
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Interlaced
Scan order                               : Top Field First
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.194
Stream size                              : 1.38 GiB (94%)

Audio
ID                                       : 1
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 2
Codec ID                                 : 50
Duration                                 : 1h 32mn
Bit rate mode                            : Constant
Bit rate                                 : 128 Kbps
Channel(s)                               : 2 channels
Sampling rate                            : 48.0 KHz
Compression mode                         : Lossy
Stream size                              : 84.8 MiB (6%)
Alignment                                : Aligned on interleaves
Interleave, duration                     : 42 ms (1.06 video frame)
Title: Re: join video via terminal
Post by: mit on April 10, 2013, 09:34:42 PM
Change codec to mpeg2video!This is the correct codec.
If not work, ensure that audio codec is in compatible format!
I think, --save command, needs to be after encoding commands, so then needs to look like this:
avidemux2_cli  --load 000.mpg --append 001.mpg --audio-codec copy {or[AC3|MP2]} --output-format PS --video-codec mpeg2video  --save video.vob
Enjoy!
Title: Re: join video via terminal
Post by: iacoposk8 on April 11, 2013, 07:39:40 AM
I read from the terminal:
MP2]}: command not found

Thanks to all for your patience
Title: Re: join video via terminal
Post by: mit on April 11, 2013, 07:56:45 AM
Quote from: iacoposk8 on April 11, 2013, 07:39:40 AM
I read from the terminal:
MP2]}: command not found

Thanks to all for your patience

Sorry!This was for example, if audio codec is not compatible.Need to use:
--audio-codec copy
  or
--audio-codec AC3
or
--audio-codec MP2
That's all.
avidemux2_cli  --load 000.mpg --append 001.mpg --audio-codec AC3 --output-format PS --video-codec mpeg2video  --save video.vob
And sorry for my English!
Title: Re: join video via terminal
Post by: iacoposk8 on April 13, 2013, 04:48:48 PM
sorry for the delay in my reply, now everything works great! perfect :)