3gp audio to ogg conversion does not work - django

I have a django app and use a call to subprocess.call('avconv -i ' + fileName + ' ' + fileNew, shell=True). The input file is a .3gp file which has only aac mono audio stream converted to an .ogg file. Conversion succeeds, but the new file seems to be damaged and audio will not play.
Here is what I got after trying to get information for one of the input files:
xxx:/workspace/build$ avconv -i audio.3gp
avconv version 0.8.10-4:0.8.10-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
built on Feb 6 2014 20:56:59 with gcc 4.6.3
audio.3gp: Invalid data found when processing input
Here is the successful convert:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/workspace/multi-device-audio-project/webapp/../static/data/matpat.3gp':
Metadata:
major_brand : 3gp4
minor_version : 0
compatible_brands: isom3gp4
creation_time : 2014-02-17 10:53:36
Duration: 00:00:20.60, start: 0.000000, bitrate: 13 kb/s
Stream #0.0(eng): Audio: aac, 8000 Hz, mono, s16, 12 kb/s
Metadata:
creation_time : 2014-02-17 10:53:36
Output #0, ogg, to '/workspace/multi-device-audio-project/webapp/../static/data/matpat.ogg':
Metadata:
major_brand : 3gp4
minor_version : 0
compatible_brands: isom3gp4
creation_time : 2014-02-17 10:53:36
encoder : Lavf53.21.1
Stream #0.0(eng): Audio: flac, 8000 Hz, mono, s16, 200 kb/s
Metadata:
creation_time : 2014-02-17 10:53:36
Stream mapping:
Stream #0:0 -> #0:0 (aac -> flac)
Press ctrl-c to stop encoding
size= 216kB time=20.66 bitrate= 85.5kbits/s
video:0kB audio:214kB global headers:0kB muxing overhead 0.612994%
Here is one of the sample files: link
The following usage strings also return me an error : audio.3gp: Invalid data found when processing input::
avconv -i audio.3gp -vn -acodec libvorbis -aq 50 audio.ogg
avconv -i audio.3gp -acodec vorbis audio.ogg
Could the input files be broken, I think they are recorded on a Nexus 7?

At the end I was able to discover the source of the problem. As I expected, the .3gp files were not properly created as they contained only audio information which resulted in avconv not being able to recognise and convert them. Changing the application to work with .aac fixed the issue.

Related

AWS lambda mp4 thumbnail generator using ffmpeg - incorrect format generated

I am trying to create a thumbnail generator for every mp4 file uploaded to the s3 bucket. I have been following this post published by AWS. The code works fine for the transcoding video file. I changed the code to generate a thumbnail. The code does generate a file but it is an invalid image type.
import json
import os
import subprocess
import shlex
import boto3
import uuid
S3_DESTINATION_BUCKET = "example-bucket"
SIGNED_URL_TIMEOUT = 60
def lambda_handler(event, context):
# s3_source_bucket = event['Records'][0]['s3']['bucket']['name']
# s3_source_key = event['Records'][0]['s3']['object']['key']
# s3_source_basename = os.path.splitext(os.path.basename(s3_source_key))[0]
# s3_destination_filename = s3_source_basename + "_cfr.ts"
hex_c = uuid.uuid4()
s3_destination_filename = '/{}/{}.{}'.format('tmp',hex_c, 'jpg')
s3_client = boto3.client('s3')
s3_media_url = 'https://s3-us-west-2.amazonaws.com/example-bucket/videos/presentations/testing.mp4'
ffmpeg_cmd = "/opt/bin/ffmpeg -i \"" + s3_media_url + "\" -ss 00:00:02 -vframes 1 \"" + s3_destination_filename + "\""
# ffmpeg_cmd = "/opt/bin/ffmpeg -i \"" + s3_source_signed_url + "\" -f mpegts -c:v copy -af aresample=async=1:first_pts=0 -"
command1 = shlex.split(ffmpeg_cmd)
p1 = subprocess.run(command1, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
resp = s3_client.put_object(Body=s3_destination_filename, Bucket=S3_DESTINATION_BUCKET, Key='{}{}'.format(hex_c, '.jpg'))
return {
'statusCode': 200,
'body': json.dumps('Processing complete successfully')
}
Output is as:
{
"statusCode": 200,
"body": "\"Processing complete successfully\""
}
Function Logs
START RequestId: b73aaacc-5da5-417a-9f98-5def438dee96 Version: $LATEST
ffmpeg version 4.1.3-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzvbi --enable-libzimg
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'https://s3-us-west-2.amazonaws.com/example-bucket/videos/presentations/testing.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isomavc1mp42
creation_time : 2020-04-17T18:31:33.000000Z
Duration: 00:00:33.07, start: 0.000000, bitrate: 90 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 854x480 [SAR 1:1 DAR 427:240], 23 kb/s, 30 fps, 30 tbr, 30 tbn, 60 tbc (default)
Metadata:
creation_time : 2020-04-17T18:31:29.000000Z
Stream #0:1(eng): Audio: aac (HE-AAC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 64 kb/s (default)
Metadata:
creation_time : 2020-04-17T18:31:29.000000Z
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
[swscaler # 0x67ddc40] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to '/tmp/4633bb13-4a15-49b7-a445-d910bebaddf6.jpg':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isomavc1mp42
encoder : Lavf58.20.100
Stream #0:0(und): Video: mjpeg, yuvj420p(pc), 854x480 [SAR 1:1 DAR 427:240], q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc (default)
Metadata:
creation_time : 2020-04-17T18:31:29.000000Z
encoder : Lavc58.35.100 mjpeg
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
frame= 0 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed= 0x
frame= 0 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed= 0x
frame= 0 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed= 0x
frame= 1 fps=0.4 q=6.3 Lsize=N/A time=00:00:00.03 bitrate=N/A speed=0.0149x
video:14kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
END RequestId: b73aaacc-5da5-417a-9f98-5def438dee96
REPORT RequestId: b73aaacc-5da5-417a-9f98-5def438dee96 Duration: 6349.25 ms Billed Duration: 6350 ms Memory Size: 155 MB Max Memory Used: 123 MB Init Duration: 368.12 ms
Request ID
b73aaacc-5da5-417a-9f98-5def438dee96
An image file is uploaded to the S3 folder, but when I try to open it flags an invalid file format. The file size is only 40.0 Bytes.
S3 bucket image folder
invalid file format

AWS MediaConvert fails when transcoding a video created from an iOS Safari WebRTC

I am trying to transcode a video using MediaConvert and I get the following error:
Error message Demuxer: [ReadPacketData File read failed - end of file
hit at length [1105924]. Is file truncated?]
When I try to run ffmpeg command to get information about the file I see this:
non monotonically increasing dts to muxer in stream
I am wondering is there a configuration in MediaConvert that can correct the time stamps?
➜ Downloads ffmpeg -i 2254.webm -hide_banner -f null /dev/null
[h264 # 0x7fce2c81d400] Increasing reorder buffer to 1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2254.webm':
Metadata:
major_brand : iso5
minor_version : 1
compatible_brands: isomiso5hlsf
creation_time : 2021-02-17T19:33:56.000000Z
Duration: 00:00:01.60, start: 0.000000, bitrate: 5535 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 1280x720, 5644 kb/s, 27.95 fps, 29.92 tbr, 600 tbn, 1200 tbc (default)
Metadata:
rotate : 90
creation_time : 2021-02-17T19:33:56.000000Z
handler_name : Core Media Video
Side data:
displaymatrix: rotation of -90.00 degrees
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 187 kb/s (default)
Metadata:
creation_time : 2021-02-17T19:33:56.000000Z
handler_name : Core Media Audio
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> wrapped_avframe (native))
Stream #0:1 -> #0:1 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, null, to '/dev/null':
Metadata:
major_brand : iso5
minor_version : 1
compatible_brands: isomiso5hlsf
encoder : Lavf58.45.100
Stream #0:0(und): Video: wrapped_avframe, yuvj420p(progressive), 720x1280, q=2-31, 200 kb/s, 29.92 fps, 29.92 tbn, 29.92 tbc (default)
Metadata:
encoder : Lavc58.91.100 wrapped_avframe
creation_time : 2021-02-17T19:33:56.000000Z
handler_name : Core Media Video
Side data:
displaymatrix: rotation of -0.00 degrees
Stream #0:1(und): Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s (default)
Metadata:
creation_time : 2021-02-17T19:33:56.000000Z
handler_name : Core Media Audio
encoder : Lavc58.91.100 pcm_s16le
[null # 0x7fce2e008200] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 8 >= 8
[null # 0x7fce2e008200] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 31 >= 31
frame= 41 fps=0.0 q=-0.0 Lsize=N/A time=00:00:01.57 bitrate=N/A speed=19.9x
video:21kB audio:128kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
At this time MediaConvert expects a fully complete, timestamped correct file. There is no way to change DTS or PTS values at demux in the service.
Are you able to just remux with ffmpeg and get the same results when passing that file to MediaConvert?
ffmpeg -i 2254.webm -c copy output.webm

AWS Lambda - ffmpeg erroneously outputs distorted/clipped mp3

How do I get an mp3 output without any distortion using ffmpeg?
I am utilizing ffmpeg on AWS Lambda linux using the static build provided by https://www.johnvansickle.com/ffmpeg/ (x86_64 build).
After running the following command, the mp3 output has terrible clipping/distortion.
ffmpeg -loglevel verbose -ss 0 -t 30 -y -i /tmp/ick_20180323005225.wav -codec:a libmp3lame -qscale:a 7 /tmp/ick_20180323005225-opa.mp3
Edit: here is the sample file that I used:
http://www.brainybetty.com/FacebookFans/Feb112010/strings.wav
Here is the log coming from Lambda:
Executing command '/tmp/ffmpeg -loglevel verbose -ss 0 -t 30 -y -i /tmp/ick_20180323005225.wav -codec:a libmp3lame -qscale:a 7 /tmp/ick_20180323005225-opa.mp3' ...
STDERR:
ffmpeg version 3.4.2-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18) 20170516
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enab
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
[wav # 0x4bbdf40] parser not found for codec pcm_s16le, packets or times may be invalid.
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, wav, from '/tmp/ick_20180323005225.wav':
Duration: 00:00:05.00, bitrate: 1411 kb/s
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (pcm_s16le (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[graph_0_in_0_0 # 0x4bc64e0] tb:1/44100 samplefmt:s16 samplerate:44100 chlayout:0x3
[format_out_0_0 # 0x4bc6360] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_0'
[auto_resampler_0 # 0x4bd2ee0] ch:2 chl:stereo fmt:s16 r:44100Hz -> ch:2 chl:stereo fmt:s16p r:44100Hz
Output #0, mp3, to '/tmp/ick_20180323005225-opa.mp3':
Metadata:
TSSE : Lavf57.83.100
Stream #0:0: Audio: mp3 (libmp3lame), 44100 Hz, stereo, s16p, delay 1105
Metadata:
encoder : Lavc57.107.100 libmp3lame
size= 11kB time=00:00:00.73 bitrate= 119.5kbits/s speed=1.41x
size= 23kB time=00:00:01.67 bitrate= 114.5kbits/s speed=1.61x
size= 36kB time=00:00:02.61 bitrate= 113.4kbits/s speed=1.65x
size= 48kB time=00:00:03.55 bitrate= 111.0kbits/s speed=1.69x
size= 60kB time=00:00:04.46 bitrate= 109.6kbits/s speed=1.71x
No more output streams to write to, finishing.
size= 67kB time=00:00:05.01 bitrate= 108.9kbits/s speed=1.75x
video:0kB audio:66kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.371917%
Input file #0 (/tmp/ick_20180323005225.wav):
Input stream #0:0 (audio): 216 packets read (881988 bytes); 216 frames decoded (220497 samples);
Total: 216 packets (881988 bytes) demuxed
Output file #0 (/tmp/ick_20180323005225-opa.mp3):
Output stream #0:0 (audio): 192 frames encoded (220497 samples); 193 packets muxed (68026 bytes);
Total: 193 packets (68026 bytes) muxed
Executed command '/tmp/ffmpeg -loglevel verbose -ss 0 -t 30 -y -i /tmp/ick_20180323005225.wav -codec:a libmp3lame -qscale:a 7 /tmp/ick_20180323005225-opa.mp3' with code: 0.

Playing sound in pyo and python

I am trying out the pyo for python. I installed the pyo for ubuntu using these commands from the homepage:
sudo apt-get install libjack-jackd2-dev libportmidi-dev portaudio19-dev liblo-dev
sudo apt-get install libsndfile-dev python-dev python-tk
sudo apt-get install python-imaging-tk python-wxgtk3.0
git clone https://github.com/belangeo/pyo.git
cd pyo
sudo python setup.py install --install-layout=deb --use-jack --use-double
Howerver when i try the very first example to Play a sound:
>>> from pyo import *
>>> s = Server().boot()
>>> s.start()
>>> sf = SfPlayer("path/to/your/sound.aif", speed=1, loop=True).out()
i get these errors:
>>> from pyo import *
pyo version 0.7.9 (uses single precision)
>>> s = Server().boot()
ALSA lib pcm_dsnoop.c:614:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1024:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_dmix.c:1024:(snd_pcm_dmix_open) unable to open slave
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
Expression 'parameters->channelCount <= maxChans' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1514
Expression 'ValidateParameters( inputParameters, hostApi, StreamDirection_In )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2818
portaudio error in Pa_OpenStream: Invalid number of channels
Portaudio error: Invalid number of channels
Server not booted.
Can anyone help?
PS: I am running ubuntu 15.10
Step 1. You should list your audio hardware:
from pyo import *
print("Audio host APIS:")
pa_list_host_apis()
pa_list_devices()
print("Default input device: %i" % pa_get_default_input())
print("Default output device: %i" % pa_get_default_output())
On my system result is:
Audio host APIS:
index: 0, id: 8, name: ALSA, num devices: 10, default in: 9, default out: 9
index: 1, id: 7, name: OSS, num devices: 0, default in: -1, default out: -1
AUDIO devices:
0: OUT, name: HDA Intel HDMI: 0 (hw:0,3), host api index: 0, default sr: 44100 Hz, latency: 0.005805 s
1: OUT, name: HDA Intel HDMI: 1 (hw:0,7), host api index: 0, default sr: 44100 Hz, latency: 0.005805 s
2: OUT, name: HDA Intel HDMI: 2 (hw:0,8), host api index: 0, default sr: 44100 Hz, latency: 0.005805 s
3: OUT, name: HDA Intel HDMI: 3 (hw:0,9), host api index: 0, default sr: 44100 Hz, latency: 0.005805 s
4: OUT, name: HDA Intel HDMI: 4 (hw:0,10), host api index: 0, default sr: 44100 Hz, latency: 0.005805 s
5: IN, name: HDA Intel PCH: CS4208 Analog (hw:1,0), host api index: 0, default sr: 44100 Hz, latency: 0.005805 s
6: OUT, name: HDA Intel PCH: CS4208 Digital (hw:1,1), host api index: 0, default sr: 44100 Hz, latency: 0.005805 s
7: OUT, name: hdmi, host api index: , default sr: 44100 Hz, latency: 0.005805 s
8: IN, name: pulse, host api index: 0, default sr: 44100 Hz, latency: 0.008707 s
8: OUT, name: pulse, host api index: 0, default sr: 44100 Hz, latency: 0.008707 s
9: IN, name: default, host api index: 0, default sr: 44100 Hz, latency: 0.008707 s
9: OUT, name: default, host api index: 0, default sr: 44100 Hz, latency: 0.008707 s
Default input device: 9
Default output device: 9
Step 2. Choose preferred device. In my case device 9 is ok.
from pyo import *
s = Server(duplex=0)
s.setOutputDevice(9) # Use device from the previous step
s.boot()
s.start()
# Try to play sound
a = Sine(mul=0.01).out()
Got it working on Ubuntu 20.04
After trying several things and a lot of frustration... the following worked:
sudo apt install python3-pyo
and the test:
#/usr/bin/env python3
from pyo import *
s = Server()
s.boot()
s.start()
a = Sine(freq=440, mul=0.5)
a.out()
time.sleep(2)
a.stop()
s.stop()
produces a 2 second 440Hz sine sound as desired. Maybe a reboot was needed.
The Ubuntu package must be installing some missing binary dependencies, without which pyo was throwing PyoServerStateException.
More details at: Pyo server.boot() fails with pyolib._core.PyoServerStateException on Ubuntu 14.04

Realtime output from ffmpeg and livestreamer using subprocess.Popen

In ffmpeg and livestreamer i only get a few lines in realtime then i get the rest of them when the process is done...
I have tried two codes:
from subprocess import *
p = Popen('ffmpeg -i infile.mp4 outfile.mp4', stderr=STDOUT, stdout=PIPE)
for line in iter(p.stdout.readline(), b'')
print line.rstrip()
and
from subprocess import *
p = Popen('ffmpeg -i infile.mp4 outfile.mp4', stderr=STDOUT, stdout=PIPE)
while p.poll is None:
line = p.stdout.readline()
print line.rstrip()
Both of them prints first:
ffmpeg version N-72805-g913685f Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopenc
ore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --ena
ble-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable
-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enabl
e-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable
-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --e
nable-lzma --enable-decklink --enable-zlib
libavutil 54. 27.100 / 54. 27.100
libavcodec 56. 41.100 / 56. 41.100
libavformat 56. 36.100 / 56. 36.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 16.101 / 5. 16.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'a.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.10.100
Duration: 01:34:36.14, start: 0.021333, bitrate: 6205 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720,
5938 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, flt
p, 256 kb/s (default)
Metadata:
handler_name : SoundHandler
[mp4 # 05013ce0] Codec for stream 0 does not use global headers but container fo
rmat requires global headers
[mp4 # 05013ce0] Codec for stream 1 does not use global headers but container fo
rmat requires global headers
Output #0, mp4, to 'b.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.36.100
Stream #0:0(und): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x720, q
=2-31, 5938 kb/s, 30 fps, 30 tbr, 15360 tbn, 15360 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 256
kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
Then when the convert process is done the rest of the log turns up...
How can i get all stdout in realtime??
EDIT:
If i use a text file to write to it get all in realtime.
from subprocess import *
out_file = open('stdout.txt','a')
Popen('ffmpeg -i infile.mp4 outfile.mp4', stderr=STDOUT, stdout=out_file)
But i want it print out stdout in realtime..
Why does it work in realtime to a file but not direct print?
please check this out:
https://stackoverflow.com/a/2358686/1314124
The reason why it can't be printed is because "ffmpeg never prints one line, the status is updated by writing \r (carrige return) and then writing the line again. "